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 SendResponse(RunImpl()); | 117 bool success = 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); |
118 } | 125 } |
119 | 126 |
120 bool BookmarksFunction::GetBookmarkIdAsInt64( | 127 bool BookmarksFunction::GetBookmarkIdAsInt64( |
121 const std::string& id_string, int64* id) { | 128 const std::string& id_string, int64* id) { |
122 if (StringToInt64(id_string, id)) | 129 if (StringToInt64(id_string, id)) |
123 return true; | 130 return true; |
124 | 131 |
125 error_ = keys::kInvalidIdError; | 132 error_ = keys::kInvalidIdError; |
126 return false; | 133 return false; |
127 } | 134 } |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 error_ = keys::kModifySpecialError; | 550 error_ = keys::kModifySpecialError; |
544 return false; | 551 return false; |
545 } | 552 } |
546 model->SetTitle(node, title); | 553 model->SetTitle(node, title); |
547 | 554 |
548 DictionaryValue* ret = ExtensionBookmarks::GetNodeDictionary(node, false); | 555 DictionaryValue* ret = ExtensionBookmarks::GetNodeDictionary(node, false); |
549 result_.reset(ret); | 556 result_.reset(ret); |
550 | 557 |
551 return true; | 558 return true; |
552 } | 559 } |
OLD | NEW |