OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "chrome/browser/bookmarks/bookmark_codec.h" | 9 #include "chrome/browser/bookmarks/bookmark_codec.h" |
10 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // Bookmarks are not ready yet. We'll wait. | 107 // Bookmarks are not ready yet. We'll wait. |
108 registrar_.Add(this, NotificationType::BOOKMARK_MODEL_LOADED, | 108 registrar_.Add(this, NotificationType::BOOKMARK_MODEL_LOADED, |
109 NotificationService::AllSources()); | 109 NotificationService::AllSources()); |
110 AddRef(); // Balanced in Observe(). | 110 AddRef(); // Balanced in Observe(). |
111 return; | 111 return; |
112 } | 112 } |
113 | 113 |
114 ExtensionBookmarkEventRouter* event_router = | 114 ExtensionBookmarkEventRouter* event_router = |
115 ExtensionBookmarkEventRouter::GetSingleton(); | 115 ExtensionBookmarkEventRouter::GetSingleton(); |
116 event_router->Observe(model); | 116 event_router->Observe(model); |
117 bool success = RunImpl(); | 117 SendResponse(RunImpl()); |
118 if (success) { | |
119 NotificationService::current()->Notify( | |
120 NotificationType::EXTENSION_BOOKMARKS_API_INVOKED, | |
121 Source<const Extension>(GetExtension()), | |
122 Details<const BookmarksFunction>(this)); | |
123 } | |
124 SendResponse(success); | |
125 } | 118 } |
126 | 119 |
127 bool BookmarksFunction::GetBookmarkIdAsInt64( | 120 bool BookmarksFunction::GetBookmarkIdAsInt64( |
128 const std::string& id_string, int64* id) { | 121 const std::string& id_string, int64* id) { |
129 if (StringToInt64(id_string, id)) | 122 if (StringToInt64(id_string, id)) |
130 return true; | 123 return true; |
131 | 124 |
132 error_ = keys::kInvalidIdError; | 125 error_ = keys::kInvalidIdError; |
133 return false; | 126 return false; |
134 } | 127 } |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 error_ = keys::kModifySpecialError; | 543 error_ = keys::kModifySpecialError; |
551 return false; | 544 return false; |
552 } | 545 } |
553 model->SetTitle(node, title); | 546 model->SetTitle(node, title); |
554 | 547 |
555 DictionaryValue* ret = ExtensionBookmarks::GetNodeDictionary(node, false); | 548 DictionaryValue* ret = ExtensionBookmarks::GetNodeDictionary(node, false); |
556 result_.reset(ret); | 549 result_.reset(ret); |
557 | 550 |
558 return true; | 551 return true; |
559 } | 552 } |
OLD | NEW |