I am trying to write a Cocoa App that needs to manipulate Chrome Bookmarks. What is the best way to get access to Chrome bookmarks to allow insertion, deletion, updating.
Chrome stores its bookmarks in a simple text file called Bookmarks which (on OS X) is stored in the user home directory, $HOME/Library/Application Support/Google/Chrome/Default/Bookmarks. It's a JSON file for which I guess there are several libraries API available. (like this one)
If you mean to directly manipulate the bookmarks stored in Google cloud, check this link.
Related
is it possible for a Firefox WebExtension to read/write to a user's userChrome.css file? I was in the process of writing an extension that allows users to customize certain browser icons. I realize this isn't possible without my extension having access to the userChrome.css file. Could reading/writing files be possible through native messaging perhaps?
I'm making a WebExtension (for Firefox) that tracks lists for the user. The user can add/remove elements from a list, or switch an element from one list to another, which means the extension needs the most recent version of the lists to work with.
So to be used on both desktop and Android, the extension needs to transfer/synchronize some data (which can be stringified).
I'm trying to find a way for the user to do it as simply as possible, without using external services.
The ideal solution for that (completely transparent for the user) would be to use storage.sync, but although it does synchronize between devices, it doesn't (yet) sync between normal Firefox (desktop) and Firefox for Android (implementation tracked at https://bugzilla.mozilla.org/show_bug.cgi?id=1316442).
Another solution would be to use the bookmarks API, but it's not supported by Firefox for Android (https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/bookmarks) either.
That leaves me with two solutions that I can see:
Letting the user save/retrieve the data to/from a local file, which means they need to copy the file to the other device (that's what I have in place right now).
Saving/retrieving the data to/from a third-party server (which means I would have to create a server, and have the user make an account on it).
Is there any other solution that I'm missing?
According to this support document, the following data is synced from/to Android: bookmarks, history, open tabs, form information and passwords.
This chart shows which web extension APIs are supported on Android:
Bookmarks: no API yet on Android
History: no API yet on Android
Tabs: API supported. Extensions that should occasionally or one-time sync could implement a manual process (this is a useless flow for OP as the question describes a flow where syncing should occur often):
Open a tab with a web-extension or data URL with sync data in the query parameters. In this tab, display some text asking the user to open Firefox on the other device. Keep a record that you opened this tab locally using sessionStorage.
When the tab is opened on the other device and the sessionStorage is missing, get the sync data from the query parameters and display a message that the data was synced and that both tabs can now be closed.
Form information: no API yet
Passwords: no API yet
Not mentioned in this list, but also synced is BrowserSettings. It allows overwriting some fields that are synced (homepageOverride, newTabPageOverride), but those fields have to be defined in manifest.json so they cannot be dynamic. Also, it would probably interfere with normal functioning.
In conclusion: wait for browser support or pick a server solution.
I have an app which needs to preserve data between times it runs. I had been using NSUserDefaults for this, but I've had a few users point this out to me: this causes different users to end up with different data, which isn't the way the app should work. It needs a single directory that it can read/write from regardless of which user is running it.
So, I need a non-user specific directory that a sandboxed mac app can read and write to.
Thanks!
(Oh, and if this directory is persistent between updates of my app, that'd be helpful, too!)
Quick barely related question: Is there a way to have a user modifiable resource file in a Mac App Store approved app? I don't want it to be modifiable via my app; I just want to make sure that users modifying it won't cause the system to kill the app for not matching a code signature hash or something.
I don't think that you will be able to read and write in a directory outside of the App Sandbox container without prompting the user to select it using Powerbox and saving a security-scoped bookmark (see App Sandbox Container Directory). From what I've gathered about App reviews lately, you won't even be able to specify a default in the open dialog if you elect to have the user choose the directory.
As for the second question, as I understand it any verification of code signatures is left to the developer. So while MAS apps have a _CodeSignature folder containing a plist with all the hashes of the resource, in my experiments changing them had no effect on app launch.
Is it possible to lock a user in chrome using .dll files (NPAPI plugin) or any other method?
I want to invoke chrome browser in highly controlled environment preferably on Windows. I would download chrome for businesses and write policies such that user isn't allowed to access any url except one.
I would create a packaged app and create an application shortcut on desktop for user which goes to the url. So it will open in KIOSK mode. But I would want that user shouldn't be able to navigate away from chrome, specifically that window and shouldn't be able to use any other program until he logs out of the application or explicitly closes the window. That means disabling function /ctrl/alt and window keys.
Something like this but with chrome.
Even opening chrome itself in 'locked' mode is not a problem.
Has someone ever implemented it? Is it possible using NPAPI plugin or any other method? If anybody could direct me towards any such resources I would be grateful.
No, this is not realistically possible using an NPAPI plugin, at least not by itself. At minimum you'd need an extension (see http://npapi.com/extensions).
If you loaded it from an extension it might be possible to get the window handle of the browser and such, but I think you'd probably be better off with a separate app.
Apps in OS X that can open files to launch their respective applications often let the user choose the app that'll open the file. An example is the Finder.
I am still unclear about what's the best solution to implement this. The challenges are performance and showing the app's icon.
First, to get the list of apps, I found only LSCopyApplicationURLsForURL().
The major difficulty for me now is to get the app icons. All I have is the URLs (paths) to the apps. The only way I know of to get the icons would be to create a CFBundle object and then read the app's plist to get the icon data. But that appears to invole lots of disk access, and I could imagine it'll be quite inefficient if the app is located on a remote file server.
I believe that there's also a cached database about the apps, which includes icons and display names (without extension), and such. But where is the API for that?
Note: The app is Carbon based, but I can make use of Cocoa (NS...) functions if necessary. Also, Support for 10.5, even 10.4, would be appreciated.
Alright. I solved it eventually.
I now use the Carbon function GetIconRefFromFileInfo(), which still works in Lion, though it's marked deprecated/obsolete.
I had also tried to use QLThumbnailImageCreate(), but that didn't get me any results, oddly. No idea what I did wrong.
For Cocoa apps, [[NSWorkspace sharedWorkspace] iconForFile:path] can be used (thanks to C. Grunenberg of DevonTechnologies for this tip, where it's used with EasyFind).