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

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

Issue 155707: Changed the extension.connect() API not to broadcast to all tabs. Added a (Closed)
Patch Set: review comments Created 11 years, 5 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
OLDNEW
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_writer.h" 7 #include "base/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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 void ExtensionBookmarkEventRouter::Observe(BookmarkModel* model) { 147 void ExtensionBookmarkEventRouter::Observe(BookmarkModel* model) {
148 if (models_.find(model) == models_.end()) { 148 if (models_.find(model) == models_.end()) {
149 model->AddObserver(this); 149 model->AddObserver(this);
150 models_.insert(model); 150 models_.insert(model);
151 } 151 }
152 } 152 }
153 153
154 void ExtensionBookmarkEventRouter::DispatchEvent(Profile *profile, 154 void ExtensionBookmarkEventRouter::DispatchEvent(Profile *profile,
155 const char* event_name, 155 const char* event_name,
156 const std::string json_args) { 156 const std::string json_args) {
157 ExtensionMessageService::GetInstance(profile->GetRequestContext())-> 157 if (profile->GetExtensionMessageService()) {
158 DispatchEventToRenderers(event_name, json_args); 158 profile->GetExtensionMessageService()->
159 DispatchEventToRenderers(event_name, json_args);
160 }
159 } 161 }
160 162
161 void ExtensionBookmarkEventRouter::Loaded(BookmarkModel* model) { 163 void ExtensionBookmarkEventRouter::Loaded(BookmarkModel* model) {
162 // TODO(erikkay): Perhaps we should send this event down to the extension 164 // TODO(erikkay): Perhaps we should send this event down to the extension
163 // so they know when it's safe to use the API? 165 // so they know when it's safe to use the API?
164 } 166 }
165 167
166 void ExtensionBookmarkEventRouter::BookmarkNodeMoved( 168 void ExtensionBookmarkEventRouter::BookmarkNodeMoved(
167 BookmarkModel* model, 169 BookmarkModel* model,
168 const BookmarkNode* old_parent, 170 const BookmarkNode* old_parent,
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 } 528 }
527 if (node == model->root_node() || 529 if (node == model->root_node() ||
528 node == model->other_node() || 530 node == model->other_node() ||
529 node == model->GetBookmarkBarNode()) { 531 node == model->GetBookmarkBarNode()) {
530 error_ = keys::kModifySpecialError; 532 error_ = keys::kModifySpecialError;
531 return false; 533 return false;
532 } 534 }
533 model->SetTitle(node, title); 535 model->SetTitle(node, title);
534 return true; 536 return true;
535 } 537 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/extension_port_container.cc ('k') | chrome/browser/extensions/extension_browser_event_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698