summaryrefslogtreecommitdiffstats
path: root/chrome/browser/bookmarks/bookmark_codec.cc
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Revert 84829 - Initial implementation of "Synced Bookmarks" folder."yfriedman@chromium.org2011-05-261-8/+41
| | | | | | | | | | | | | | | | | | | | | | Second attempt to land this change. Fixes memory leak (82186), deleted bookmarks (82273) and crash on add bookmarks in windows (82349). Original desscription: Mostly ensures that sycned bookmarks are correctly treated as an immutable folder. Some of the UI-bits maybe incomplete. For example, if enable-synced-bookmarks-folder is set, then synced bookmarks will appear in the bookmark manager page and some components of the UI but it's not on the bookmark bar or anything like that. This change also ensures that the synced bookmark folder matches a sync folder if one is available. BUG= TEST=test bookmark addition/moving around in combination with sync Review URL: http://codereview.chromium.org/7012005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86902 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 84829 - Initial implementation of "Synced Bookmarks" folder.yfriedman@chromium.org2011-05-111-26/+7
| | | | | | | | | | | | | | | | | | | Mostly ensures that sycned bookmarks are correctly treated as an immutable folder. Some of the UI-bits maybe incomplete. For example, if enable-synced-bookmarks-folder is set, then synced bookmarks will appear in the bookmark manager page and some components of the UI but it's not on the bookmark bar or anything like that. This change also ensures that the synced bookmark folder matches a sync folder if one is available. BUG= TEST= Review URL: http://codereview.chromium.org/6931018 TBR=yfriedman@chromium.org Review URL: http://codereview.chromium.org/6982028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84985 0039d316-1c4b-4281-b951-d872f2087c98
* Initial implementation of "Synced Bookmarks" folder.yfriedman@chromium.org2011-05-101-7/+26
| | | | | | | | | | | | | | | | Mostly ensures that sycned bookmarks are correctly treated as an immutable folder. Some of the UI-bits maybe incomplete. For example, if enable-synced-bookmarks-folder is set, then synced bookmarks will appear in the bookmark manager page and some components of the UI but it's not on the bookmark bar or anything like that. This change also ensures that the synced bookmark folder matches a sync folder if one is available. BUG= TEST= Review URL: http://codereview.chromium.org/6931018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84829 0039d316-1c4b-4281-b951-d872f2087c98
* Reverse the order of parameters in TreeNode::Add function.tfarina@chromium.org2011-03-181-2/+2
| | | | | | | | | | | | | This is so it matches with the signature used in View class. BUG=None TEST=None R=sky@chromium.org Review URL: http://codereview.chromium.org/6683024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78712 0039d316-1c4b-4281-b951-d872f2087c98
* Rename TreeNode::SetTitle to TreeNode::set_title. Part 4.tfarina@chromium.org2011-03-111-3/+3
| | | | | | | | | | | | | | | | While I'm here: - Add OVERRIDE to some methods. - Remove unnecessary include. - Remove "virtual" keyword from a method that doesn't need to be overridden. - Remove an unused forward declaration. - And some other random cleanups. BUG=None TEST=existing unit_tests. Review URL: http://codereview.chromium.org/6673017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77844 0039d316-1c4b-4281-b951-d872f2087c98
* bookmarks: Rename entries with group_modified to folder_modified.tfarina@chromium.org2011-03-111-2/+2
| | | | | | | | | | | | | This is the first part to get rid of references to group in the bookmarks API. All of them will be changed from group to folder to make it consistent, since right now we have a mix of them. BUG=None TEST=None Review URL: http://codereview.chromium.org/6667013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77760 0039d316-1c4b-4281-b951-d872f2087c98
* Rename TreeNode::GetChildCount to TreeNode::child_count. Part 3.tfarina@chromium.org2011-03-101-5/+5
| | | | | | | | | | | | This is part of a serie of patches to make the TreeNode API more closer to style used in the Views Tree API (see views/view.h for reference). BUG=None TEST=existing unit_tests. Review URL: http://codereview.chromium.org/6639015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77592 0039d316-1c4b-4281-b951-d872f2087c98
* Move l10n_util to ui/baseben@chromium.org2011-01-211-1/+1
| | | | | | | | | BUG=none TEST=none TBR=brettw git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72227 0039d316-1c4b-4281-b951-d872f2087c98
* FBTF: Even more ctor/virtual deinlining.erg@google.com2010-10-191-0/+2
| | | | | | | | | | | (Only 424k off Linux debug .a files). BUG=none TEST=compiles Review URL: http://codereview.chromium.org/3859003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63059 0039d316-1c4b-4281-b951-d872f2087c98
* Remove the wstring TreeModelNode::GetTitle() and rename GetTitleAsString16() ↵viettrungluu@chromium.org2010-08-301-1/+1
| | | | | | | | | | | to GetTitle(). BUG=23581 TEST=builds and passes tests Review URL: http://codereview.chromium.org/3279005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57834 0039d316-1c4b-4281-b951-d872f2087c98
* Remove wstrings from bookmarks, part 7.viettrungluu@chromium.org2010-08-211-2/+2
| | | | | | | | | BUG=23581 TEST=builds and passes tests Review URL: http://codereview.chromium.org/3140022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57000 0039d316-1c4b-4281-b951-d872f2087c98
* Rename GetStringAsUTF16() to GetString() (and overload), etc.viettrungluu@chromium.org2010-08-041-13/+13
| | | | | | | | | | | | Also do some drive-by wstring/wchar_t -> string/char changes (in addition to the necessary ones). BUG=none TEST=builds and tests pass Review URL: http://codereview.chromium.org/3091005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54944 0039d316-1c4b-4281-b951-d872f2087c98
* Rename DictionaryValue's SetStringFromUTF16() to SetString() (and overload).viettrungluu@chromium.org2010-08-041-2/+2
| | | | | | | | | | | | | Also do a bunch of drive-by changes while I'm at it. Still to do: rename GetStringAsUTF16() to GetString(). BUG=none TEST=builds everywhere, tests pass Review URL: http://codereview.chromium.org/3033050 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54915 0039d316-1c4b-4281-b951-d872f2087c98
* Convert more callers of the integer/string functions to usingbrettw@chromium.org2010-07-311-5/+7
| | | | | | | | | | string_number_conversions.h TEST=it compiles BUG=none Review URL: http://codereview.chromium.org/3013046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54454 0039d316-1c4b-4281-b951-d872f2087c98
* Move the number conversions from string_util to a new file.brettw@chromium.org2010-07-301-5/+6
| | | | | | | | | | | | | Use the base namespace in the new file. Update callers. I removed all wstring variants and also the string->number ones that ignore the return value. That encourages people to write code and forget about error handling. TEST=included unit tests BUG=none Review URL: http://codereview.chromium.org/3056029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54355 0039d316-1c4b-4281-b951-d872f2087c98
* More bookmarks string1t work.munjal@chromium.org2010-01-211-26/+26
| | | | | | | | | TEST=exists BUG=32013 Review URL: http://codereview.chromium.org/546094 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36805 0039d316-1c4b-4281-b951-d872f2087c98
* Fix for crash when a bookmark URL is an empty string tim@chromium.org2009-10-301-2/+3
| | | | | | | | | | | | BUG=19852 TEST=See repro steps of the bug Patch by Bruno Calvignac <BrunoCalvignac@gmail.com> Original CL http://codereview.chromium.org/282004 Review URL: http://codereview.chromium.org/342046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30540 0039d316-1c4b-4281-b951-d872f2087c98
* Lands http://codereview.chromium.org/272036 for Thiago:sky@chromium.org2009-10-191-5/+5
| | | | | | | | | | | | | | Rename GetType and SetType using the Unix style to match with the other usages in BookmarkNode. GetType -> type SetType -> set_type BUG=None TEST=None Review URL: http://codereview.chromium.org/297005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29443 0039d316-1c4b-4281-b951-d872f2087c98
* Makes sure bookmark ids are unique on reading from file. If not uniquesky@chromium.org2009-10-071-6/+15
| | | | | | | | | | | | | | | we reassign them. The particular scenario that can lead to this is when migrating bookmarks out of the db we never reset the ids of the newly created nodes, so that we wrote all to the file with ids of 0. I'm not patching that code so that I have coverage of the unit test, and we'll handle fix up during reading anyway. BUG=24060 TEST=covered by unit tests Review URL: http://codereview.chromium.org/268001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28346 0039d316-1c4b-4281-b951-d872f2087c98
* Convert internal time format to Windows 1601 epoch on Linux & Mac.brettw@chromium.org2009-08-261-2/+16
| | | | | | | | | | | Although we represent time internally starting from 1601, there are still things like time explosion that will not work before the year 1900. This limitation is the same as it was previously. BUG=14734 Review URL: http://codereview.chromium.org/173296 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24417 0039d316-1c4b-4281-b951-d872f2087c98
* Fixing potential memory leak in BookmarkCodec::DecodeNode.finnur@chromium.org2009-08-041-2/+9
| | | | | | | | | | | Coverity finds a condition where this leaks. We are at the moment not using it in such a way that it leaks, but that might of course change. It looks to me like the API is not intended to be used in such a way anyway, so we can just check for it and return false. BUG=15350 TEST=Decoding bookmarks should work as before. Review URL: http://codereview.chromium.org/159075 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22379 0039d316-1c4b-4281-b951-d872f2087c98
* Don't use ID generation logic always. Only reassign IDsmunjal@chromium.org2009-07-151-69/+31
| | | | | | | | | | | | | | when checksums differ or if IDs are missing and do that simply by assigning the next maximum id. Add a unit test. BUG=16357 TEST=NONE Review URL: http://codereview.chromium.org/155560 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20779 0039d316-1c4b-4281-b951-d872f2087c98
* Try the original CL "Always persist bookmark IDs" again with the fix tomunjal@chromium.org2009-07-131-24/+23
| | | | | | | | | | | | | | Valgrind issue. The fix is in bookmark_storage.h - initialized the newly added member ids_reassigned_ of LoadDetails class. See http://codereview.chromium.org/149310 for the original CL. TEST=NONE BUG=16068 Review URL: http://codereview.chromium.org/155456 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20565 0039d316-1c4b-4281-b951-d872f2087c98
* Revert "Always persist bookmark IDs."tc@google.com2009-07-131-23/+24
| | | | | | | | | | | | | This reverts commit r20532 because valgrind was complaining about uninitialized memory: http://build.chromium.org/buildbot/waterfall/builders/Chromium%20Linux%20(valgrind)/builds/697/steps/valgrind%20test:%20unit/logs/stdio TBR=munjal Review URL: http://codereview.chromium.org/155448 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20550 0039d316-1c4b-4281-b951-d872f2087c98
* Always persist bookmark IDs.munjal@chromium.org2009-07-131-24/+23
| | | | | | | | | | | | | | | | Remove the preference to persist IDs. NOTE that we need to save the file the first time with IDs since existing bookmark files won't have IDs and the file won't be saved until something changes in the bookmark model. So we need to explicitly save once when we assign ids for the first time. TEST=NONE BUG=16068 Review URL: http://codereview.chromium.org/149310 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20532 0039d316-1c4b-4281-b951-d872f2087c98
* Lands http://codereview.chromium.org/155128 for Thiago.sky@chromium.org2009-07-081-5/+6
| | | | | | | | | | | | | Description from Thiago: Converting the history::StarredEntry::Type to a type defined in BookmarkNode. BUG=NONE TEST=NONE Review URL: http://codereview.chromium.org/155165 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20195 0039d316-1c4b-4281-b951-d872f2087c98
* Make bookmark model public interface use const BookmarkNode* instead ofmunjal@chromium.org2009-06-261-11/+11
| | | | | | | | | | | | | | | BookmarkNode*. This helps in making the BookmarkNode class setters public also without worrying about someone inadvertently changing BookmarkNode properties directly for bookmark model bookmarks. Change all the call sites to reflect this. BUG=none TEST=none Review URL: http://codereview.chromium.org/146116 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19428 0039d316-1c4b-4281-b951-d872f2087c98
* Should provide checks while loading bookmarksmhm@chromium.org2009-06-091-12/+6
| | | | | | | | | | | | | | Instead of providing a separate check to validate bookmarks while loading, we could assume invalid bookmarks are invalid, hence we don't break the loading sequence. We keep looping since another bookmark might be valid. If the JSON syntax is broken, it will exit gracefully because the parser can't parse the file. This patch is only good for people who are editing their bookmarks directly and missing a item in the bookmark node. BUG=10709 (http://crbug.com/10709) TEST=Deleted any line from the Bookmarks file within the bookmark children node. Loaded up Chromium and it loaded the error free bookmarks. Review URL: http://codereview.chromium.org/118351 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17960 0039d316-1c4b-4281-b951-d872f2087c98
* Don't allow duplicate bookmark node ids by always assigning ids with the ↵tim@chromium.org2009-05-221-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | ones generated by the codec. The bookmark bar and other bookmarks nodes get initialized by the model to ids 1 and 2, respectively. Later, when the BookmarkCodec is decoding, it starts with the bookmark bar which has id 1, but continues depth-first from this node instead of handling other_bookmarks next. This means the first child of the bookmark bar gets id 2, and this was colliding with other_bookmarks because the codec wasn't overwriting the id when a valid |node| is passed in. In other words, two exclusive unique ID generators are not better than one. I considered other things, like calling RecordId on the id_generator for the "special node" ids, but that caused PersistIds test to fail. Also considered special-casing the two special nodes in Decode, but those attempts felt either more subtle or lame than this one. TEST=BookmarkModelTestWithProfile.CreateAndRestore Review URL: http://codereview.chromium.org/115696 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16772 0039d316-1c4b-4281-b951-d872f2087c98
* Moves decoding and population of bookmark index to background thread.sky@chromium.org2009-05-221-20/+22
| | | | | | | | | BUG=6646 TEST=make sure bookmarks persist after running chrome. Review URL: http://codereview.chromium.org/113768 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16757 0039d316-1c4b-4281-b951-d872f2087c98
* Moves GetFavIcon from BookmarkNode to BookmarkModel. I'm doing thissky@chromium.org2009-05-201-2/+2
| | | | | | | | | | | | | | | | for two reasons: . it cuts down on each node needing a reference to the model. . it makes it clear nodes shouldn't need to talk with the model. I'm primarily doing this for the last point as I'm going to populate nodes on a background thread shortly and I don't want to risk the chance of someone trying to talk with the model. BUG=none TEST=none Review URL: http://codereview.chromium.org/113617 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16491 0039d316-1c4b-4281-b951-d872f2087c98
* Move the bookmark node iD generation to bookmark model isntead ofmunjal@chromium.org2009-05-121-7/+38
| | | | | | | | bookmark node. This will also make the IDs more dense. Review URL: http://codereview.chromium.org/99304 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15839 0039d316-1c4b-4281-b951-d872f2087c98
* Move l10n_util to app/ben@chromium.org2009-05-051-2/+1
| | | | | | | http://crbug.com/11387 Review URL: http://codereview.chromium.org/109043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15352 0039d316-1c4b-4281-b951-d872f2087c98
* Implement ID persistence for bookmarks:munjal@chromium.org2009-04-301-9/+71
| | | | | | | | | | | | | | | | - Bookmark codec now takes in a ctor argument persist_ids - If it's true, it will serialize IDs of bookmarks when encoding, and deserialize already serialized IDs (if present) when decoding. - During decoding, unique-ify the IDs if they are not unique. - Add unit tests for all new code. Coming up in a separate changelist: - Move ID generation logic to bookmark model, and make it non-static. Review URL: http://codereview.chromium.org/99217 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15013 0039d316-1c4b-4281-b951-d872f2087c98
* Add a way to checksum bookmark data to help determine if themunjal@chromium.org2009-04-271-23/+85
| | | | | | | | | | | | | | bookmarks file was changed by the user between two chrome runs. - BookmarkCodec now serializes a checksum of bookmark data along side bookmark data during encoding. - During decoding BookmarkCodec computes the checksum of deserialized data, and it also reads the checksum in the file. - BookmarkCodec exposes both the checksums via getters. - Add unit tests for BookmarkCodec, right now only checksum related. Review URL: http://codereview.chromium.org/69028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14612 0039d316-1c4b-4281-b951-d872f2087c98
* Fixes CRLF and trailing white spaces.maruel@chromium.org2009-03-051-1/+1
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10982 0039d316-1c4b-4281-b951-d872f2087c98
* revert broken change 10833nsylvain@chromium.org2009-03-031-47/+38
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10837 0039d316-1c4b-4281-b951-d872f2087c98
* Port DictionaryValue to use string16 instead of wstring.dsh@google.com2009-03-031-38/+47
| | | | | | | Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=10818 Review URL: http://codereview.chromium.org/31014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10833 0039d316-1c4b-4281-b951-d872f2087c98
* Revert dsh's change 10818nsylvain@chromium.org2009-03-031-42/+34
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10821 0039d316-1c4b-4281-b951-d872f2087c98
* Port DictionaryValue to use string16 instead of wstring.dsh@google.com2009-03-031-34/+42
| | | | | | Review URL: http://codereview.chromium.org/31014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10818 0039d316-1c4b-4281-b951-d872f2087c98
* Get rid of wstring variants of StringToFoo.dsh@google.com2009-02-281-4/+4
| | | | | | Review URL: http://codereview.chromium.org/28281 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10664 0039d316-1c4b-4281-b951-d872f2087c98
* Update include paths for grit files. Go ahead and resorttc@google.com2009-02-221-2/+1
| | | | | | | | the headers too. Review URL: http://codereview.chromium.org/21472 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10167 0039d316-1c4b-4281-b951-d872f2087c98
* Port some files in chrome/browser/ - part 1.deanm@chromium.org2008-11-251-2/+1
| | | | | | | Review URL: http://codereview.chromium.org/11402 Patch from Pawel Hajdan Jr. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6007 0039d316-1c4b-4281-b951-d872f2087c98
* Adds import/export of bookmarks to bookmarks.html file.sky@google.com2008-11-071-15/+12
| | | | | | | | | | | | BUG=1649 TEST=bring up bookmark manager and try out import/export from the tools menu. Note that import ALWAYS creates a new folder under the 'Other bookmarks folder' with the name of Imported (x). This is by design. Review URL: http://codereview.chromium.org/9471 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4968 0039d316-1c4b-4281-b951-d872f2087c98
* Move Time, TimeDelta and TimeTicks into namespace base.dsh@google.com2008-10-271-1/+2
| | | | | | Review URL: http://codereview.chromium.org/7995 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4022 0039d316-1c4b-4281-b951-d872f2087c98
* Port some more of chrome/ to Linux.deanm@google.com2008-10-021-0/+1
| | | | | | | | Original review: http://codereview.chromium.org/4247 Patch from Pawel Hajdan Jr. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2793 0039d316-1c4b-4281-b951-d872f2087c98
* Renames BoomarkBarModel to BookmarkModel.sky@google.com2008-09-111-13/+13
| | | | | | | | | BUG=none TEST=none Review URL: http://codereview.chromium.org/1912 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2057 0039d316-1c4b-4281-b951-d872f2087c98
* Moves bookmark related classes into bookmarks directory. There are nosky@google.com2008-09-091-0/+195
code changes here (other than converting to COPY_AND_BLAH_BLAH and updating include guards). BUG=none TEST=none Review URL: http://codereview.chromium.org/1868 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1944 0039d316-1c4b-4281-b951-d872f2087c98