OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bookmarks/bookmark_extension_api.h" | 5 #include "chrome/browser/bookmarks/bookmark_extension_api.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/i18n/file_util_icu.h" | 9 #include "base/i18n/file_util_icu.h" |
10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 if (model_) { | 144 if (model_) { |
145 model_->RemoveObserver(this); | 145 model_->RemoveObserver(this); |
146 } | 146 } |
147 } | 147 } |
148 | 148 |
149 void BookmarkExtensionEventRouter::DispatchEvent( | 149 void BookmarkExtensionEventRouter::DispatchEvent( |
150 Profile* profile, | 150 Profile* profile, |
151 const char* event_name, | 151 const char* event_name, |
152 scoped_ptr<ListValue> event_args) { | 152 scoped_ptr<ListValue> event_args) { |
153 if (extensions::ExtensionSystem::Get(profile)->event_router()) { | 153 if (extensions::ExtensionSystem::Get(profile)->event_router()) { |
154 scoped_ptr<extensions::Event> event(new extensions::Event( | |
Yoyo Zhou
2012/12/05 22:28:32
You might be able to use make_scoped_ptr to inline
Matt Perry
2012/12/05 22:53:53
Ah, for some reason I thought make_scoped_ptr didn
| |
155 event_name, event_args.Pass())); | |
154 extensions::ExtensionSystem::Get(profile)->event_router()-> | 156 extensions::ExtensionSystem::Get(profile)->event_router()-> |
155 DispatchEventToRenderers(event_name, event_args.Pass(), NULL, GURL(), | 157 BroadcastEvent(event.Pass()); |
156 extensions::EventFilteringInfo()); | |
157 } | 158 } |
158 } | 159 } |
159 | 160 |
160 void BookmarkExtensionEventRouter::Loaded(BookmarkModel* model, | 161 void BookmarkExtensionEventRouter::Loaded(BookmarkModel* model, |
161 bool ids_reassigned) { | 162 bool ids_reassigned) { |
162 // TODO(erikkay): Perhaps we should send this event down to the extension | 163 // TODO(erikkay): Perhaps we should send this event down to the extension |
163 // so they know when it's safe to use the API? | 164 // so they know when it's safe to use the API? |
164 } | 165 } |
165 | 166 |
166 void BookmarkExtensionEventRouter::BookmarkModelBeingDeleted( | 167 void BookmarkExtensionEventRouter::BookmarkModelBeingDeleted( |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
959 int index, | 960 int index, |
960 void* params) { | 961 void* params) { |
961 #if !defined(OS_ANDROID) | 962 #if !defined(OS_ANDROID) |
962 // Android does not have support for the standard exporter. | 963 // Android does not have support for the standard exporter. |
963 // TODO(jgreenwald): remove ifdef once extensions are no longer built on | 964 // TODO(jgreenwald): remove ifdef once extensions are no longer built on |
964 // Android. | 965 // Android. |
965 bookmark_html_writer::WriteBookmarks(profile(), path, NULL); | 966 bookmark_html_writer::WriteBookmarks(profile(), path, NULL); |
966 #endif | 967 #endif |
967 Release(); // Balanced in BookmarksIOFunction::SelectFile() | 968 Release(); // Balanced in BookmarksIOFunction::SelectFile() |
968 } | 969 } |
OLD | NEW |