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_manager_extension_api.h" | 5 #include "chrome/browser/bookmarks/bookmark_manager_extension_api.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/prefs/public/pref_service_base.h" | 10 #include "base/prefs/public/pref_service_base.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
166 | 166 |
167 BookmarkManagerExtensionEventRouter::~BookmarkManagerExtensionEventRouter() { | 167 BookmarkManagerExtensionEventRouter::~BookmarkManagerExtensionEventRouter() { |
168 BookmarkTabHelper* bookmark_tab_helper = | 168 BookmarkTabHelper* bookmark_tab_helper = |
169 BookmarkTabHelper::FromWebContents(web_contents_); | 169 BookmarkTabHelper::FromWebContents(web_contents_); |
170 if (bookmark_tab_helper->GetBookmarkDragDelegate() == this) | 170 if (bookmark_tab_helper->GetBookmarkDragDelegate() == this) |
171 bookmark_tab_helper->SetBookmarkDragDelegate(NULL); | 171 bookmark_tab_helper->SetBookmarkDragDelegate(NULL); |
172 } | 172 } |
173 | 173 |
174 void BookmarkManagerExtensionEventRouter::DispatchEvent( | 174 void BookmarkManagerExtensionEventRouter::DispatchEvent( |
175 const char* event_name, scoped_ptr<ListValue> args) { | 175 const char* event_name, scoped_ptr<ListValue> args) { |
176 if (!extensions::ExtensionSystem::Get(profile_)->event_router()) | 176 if (!extensions::ExtensionSystem::Get(profile_)->event_router()) |
tfarina
2012/12/05 22:59:12
you can also rewrite this function in the same man
| |
177 return; | 177 return; |
178 | 178 |
179 scoped_ptr<extensions::Event> event(new extensions::Event( | |
180 event_name, args.Pass())); | |
179 extensions::ExtensionSystem::Get(profile_)->event_router()-> | 181 extensions::ExtensionSystem::Get(profile_)->event_router()-> |
180 DispatchEventToRenderers(event_name, args.Pass(), NULL, GURL(), | 182 BroadcastEvent(event.Pass()); |
tfarina
2012/12/05 22:57:19
do you want to do the same you did in bookmark_ext
| |
181 extensions::EventFilteringInfo()); | |
182 } | 183 } |
183 | 184 |
184 void BookmarkManagerExtensionEventRouter::DispatchDragEvent( | 185 void BookmarkManagerExtensionEventRouter::DispatchDragEvent( |
185 const BookmarkNodeData& data, const char* event_name) { | 186 const BookmarkNodeData& data, const char* event_name) { |
186 if (data.size() == 0) | 187 if (data.size() == 0) |
187 return; | 188 return; |
188 | 189 |
189 scoped_ptr<ListValue> args(new ListValue()); | 190 scoped_ptr<ListValue> args(new ListValue()); |
190 BookmarkNodeDataToJSON(profile_, data, args.get()); | 191 BookmarkNodeDataToJSON(profile_, data, args.get()); |
191 DispatchEvent(event_name, args.Pass()); | 192 DispatchEvent(event_name, args.Pass()); |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
515 bool can_open_new_windows = true; | 516 bool can_open_new_windows = true; |
516 | 517 |
517 #if defined(OS_WIN) | 518 #if defined(OS_WIN) |
518 if (base::win::IsMetroProcess()) | 519 if (base::win::IsMetroProcess()) |
519 can_open_new_windows = false; | 520 can_open_new_windows = false; |
520 #endif // OS_WIN | 521 #endif // OS_WIN |
521 | 522 |
522 SetResult(new base::FundamentalValue(can_open_new_windows)); | 523 SetResult(new base::FundamentalValue(can_open_new_windows)); |
523 return true; | 524 return true; |
524 } | 525 } |
OLD | NEW |