Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: chrome/browser/extensions/extension_bookmarks_module.cc

Issue 7012005: Revert "Revert 84829 - Initial implementation of "Synced Bookmarks" folder." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix linux test failure Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_bookmarks_module.h" 5 #include "chrome/browser/extensions/extension_bookmarks_module.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/i18n/file_util_icu.h" 8 #include "base/i18n/file_util_icu.h"
9 #include "base/i18n/time_formatting.h" 9 #include "base/i18n/time_formatting.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 514
515 DictionaryValue* destination; 515 DictionaryValue* destination;
516 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &destination)); 516 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &destination));
517 517
518 BookmarkModel* model = profile()->GetBookmarkModel(); 518 BookmarkModel* model = profile()->GetBookmarkModel();
519 const BookmarkNode* node = model->GetNodeByID(ids.front()); 519 const BookmarkNode* node = model->GetNodeByID(ids.front());
520 if (!node) { 520 if (!node) {
521 error_ = keys::kNoNodeError; 521 error_ = keys::kNoNodeError;
522 return false; 522 return false;
523 } 523 }
524 if (node == model->root_node() || 524 if (node == model->root_node() ||
sky 2011/05/17 15:59:08 is_permanent_node
Yaron 2011/05/17 19:17:33 Done.
525 node == model->other_node() || 525 node == model->other_node() ||
526 node == model->synced_node() ||
526 node == model->GetBookmarkBarNode()) { 527 node == model->GetBookmarkBarNode()) {
527 error_ = keys::kModifySpecialError; 528 error_ = keys::kModifySpecialError;
528 return false; 529 return false;
529 } 530 }
530 531
531 const BookmarkNode* parent = NULL; 532 const BookmarkNode* parent = NULL;
532 if (!destination->HasKey(keys::kParentIdKey)) { 533 if (!destination->HasKey(keys::kParentIdKey)) {
533 // Optional, defaults to current parent. 534 // Optional, defaults to current parent.
534 parent = node->parent(); 535 parent = node->parent();
535 } else { 536 } else {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 error_ = keys::kInvalidUrlError; 609 error_ = keys::kInvalidUrlError;
609 return false; 610 return false;
610 } 611 }
611 612
612 BookmarkModel* model = profile()->GetBookmarkModel(); 613 BookmarkModel* model = profile()->GetBookmarkModel();
613 const BookmarkNode* node = model->GetNodeByID(ids.front()); 614 const BookmarkNode* node = model->GetNodeByID(ids.front());
614 if (!node) { 615 if (!node) {
615 error_ = keys::kNoNodeError; 616 error_ = keys::kNoNodeError;
616 return false; 617 return false;
617 } 618 }
618 if (node == model->root_node() || 619 if (node == model->root_node() ||
sky 2011/05/17 15:59:08 is_permanent_node
Yaron 2011/05/17 19:17:33 Done.
619 node == model->other_node() || 620 node == model->other_node() ||
621 node == model->synced_node() ||
620 node == model->GetBookmarkBarNode()) { 622 node == model->GetBookmarkBarNode()) {
621 error_ = keys::kModifySpecialError; 623 error_ = keys::kModifySpecialError;
622 return false; 624 return false;
623 } 625 }
624 if (has_title) 626 if (has_title)
625 model->SetTitle(node, title); 627 model->SetTitle(node, title);
626 if (!url.is_empty()) 628 if (!url.is_empty())
627 model->SetURL(node, url); 629 model->SetURL(node, url);
628 630
629 DictionaryValue* ret = 631 DictionaryValue* ret =
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE); 910 SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE);
909 return true; 911 return true;
910 } 912 }
911 913
912 void ExportBookmarksFunction::FileSelected(const FilePath& path, 914 void ExportBookmarksFunction::FileSelected(const FilePath& path,
913 int index, 915 int index,
914 void* params) { 916 void* params) {
915 bookmark_html_writer::WriteBookmarks(profile(), path, NULL); 917 bookmark_html_writer::WriteBookmarks(profile(), path, NULL);
916 Release(); // Balanced in BookmarksIOFunction::SelectFile() 918 Release(); // Balanced in BookmarksIOFunction::SelectFile()
917 } 919 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698