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

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

Issue 155441: Nukes the 3 arg TabMoved variant in favor of the 4 arg variant.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: 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 | Annotate | Revision Log
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_browser_event_router.h" 5 #include "chrome/browser/extensions/extension_browser_event_router.h"
6 6
7 #include "base/json_writer.h" 7 #include "base/json_writer.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/browser.h" 9 #include "chrome/browser/browser.h"
10 #include "chrome/browser/profile.h" 10 #include "chrome/browser/profile.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 bool foreground) { 143 bool foreground) {
144 ListValue args; 144 ListValue args;
145 args.Append(ExtensionTabUtil::CreateTabValue(contents)); 145 args.Append(ExtensionTabUtil::CreateTabValue(contents));
146 std::string json_args; 146 std::string json_args;
147 JSONWriter::Write(&args, false, &json_args); 147 JSONWriter::Write(&args, false, &json_args);
148 148
149 DispatchEvent(contents->profile(), events::kOnTabCreated, json_args); 149 DispatchEvent(contents->profile(), events::kOnTabCreated, json_args);
150 150
151 registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, 151 registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED,
152 Source<NavigationController>(&contents->controller())); 152 Source<NavigationController>(&contents->controller()));
153 153
154 // Observing TAB_CONTENTS_DESTROYED is necessary because it's 154 // Observing TAB_CONTENTS_DESTROYED is necessary because it's
155 // possible for tabs to be created, detached and then destroyed without 155 // possible for tabs to be created, detached and then destroyed without
156 // ever having been re-attached and closed. This happens in the case of 156 // ever having been re-attached and closed. This happens in the case of
157 // a devtools TabContents that is opened in window, docked, then closed. 157 // a devtools TabContents that is opened in window, docked, then closed.
158 registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED, 158 registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED,
159 Source<TabContents>(contents)); 159 Source<TabContents>(contents));
160 } 160 }
161 161
162 void ExtensionBrowserEventRouter::TabInsertedAt(TabContents* contents, 162 void ExtensionBrowserEventRouter::TabInsertedAt(TabContents* contents,
163 int index, 163 int index,
164 bool foreground) { 164 bool foreground) {
165 // If tab is new, send tab-created event. 165 // If tab is new, send tab-created event.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 247
248 std::string json_args; 248 std::string json_args;
249 JSONWriter::Write(&args, false, &json_args); 249 JSONWriter::Write(&args, false, &json_args);
250 250
251 DispatchEvent(new_contents->profile(), events::kOnTabSelectionChanged, 251 DispatchEvent(new_contents->profile(), events::kOnTabSelectionChanged,
252 json_args); 252 json_args);
253 } 253 }
254 254
255 void ExtensionBrowserEventRouter::TabMoved(TabContents* contents, 255 void ExtensionBrowserEventRouter::TabMoved(TabContents* contents,
256 int from_index, 256 int from_index,
257 int to_index) { 257 int to_index,
258 bool pinned_state_changed) {
258 ListValue args; 259 ListValue args;
259 args.Append(Value::CreateIntegerValue(ExtensionTabUtil::GetTabId(contents))); 260 args.Append(Value::CreateIntegerValue(ExtensionTabUtil::GetTabId(contents)));
260 261
261 DictionaryValue* object_args = new DictionaryValue(); 262 DictionaryValue* object_args = new DictionaryValue();
262 object_args->Set(tab_keys::kWindowIdKey, Value::CreateIntegerValue( 263 object_args->Set(tab_keys::kWindowIdKey, Value::CreateIntegerValue(
263 ExtensionTabUtil::GetWindowIdOfTab(contents))); 264 ExtensionTabUtil::GetWindowIdOfTab(contents)));
264 object_args->Set(tab_keys::kFromIndexKey, Value::CreateIntegerValue( 265 object_args->Set(tab_keys::kFromIndexKey, Value::CreateIntegerValue(
265 from_index)); 266 from_index));
266 object_args->Set(tab_keys::kToIndexKey, Value::CreateIntegerValue( 267 object_args->Set(tab_keys::kToIndexKey, Value::CreateIntegerValue(
267 to_index)); 268 to_index));
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 data->Set(tab_keys::kTabUrlKey, Value::CreateStringValue(url)); 341 data->Set(tab_keys::kTabUrlKey, Value::CreateStringValue(url));
341 object_args->Set(tab_keys::kDataKey, data); 342 object_args->Set(tab_keys::kDataKey, data);
342 343
343 args.Append(object_args); 344 args.Append(object_args);
344 345
345 std::string json_args; 346 std::string json_args;
346 JSONWriter::Write(&args, false, &json_args); 347 JSONWriter::Write(&args, false, &json_args);
347 348
348 DispatchEvent(profile, events::kOnPageActionExecuted, json_args); 349 DispatchEvent(profile, events::kOnPageActionExecuted, json_args);
349 } 350 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_browser_event_router.h ('k') | chrome/browser/gtk/tabs/tab_strip_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698