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

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

Issue 3210007: Add support for a "split" incognito behavior for extensions. (Closed)
Patch Set: latest Created 10 years, 3 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/json_writer.h" 7 #include "base/json/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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 ExtensionBrowserEventRouter* ExtensionBrowserEventRouter::GetInstance() { 62 ExtensionBrowserEventRouter* ExtensionBrowserEventRouter::GetInstance() {
63 return Singleton<ExtensionBrowserEventRouter>::get(); 63 return Singleton<ExtensionBrowserEventRouter>::get();
64 } 64 }
65 65
66 static void DispatchEvent(Profile* profile, 66 static void DispatchEvent(Profile* profile,
67 const char* event_name, 67 const char* event_name,
68 const std::string json_args) { 68 const std::string json_args) {
69 if (profile->GetExtensionMessageService()) { 69 if (profile->GetExtensionMessageService()) {
70 profile->GetExtensionMessageService()->DispatchEventToRenderers( 70 profile->GetExtensionMessageService()->DispatchEventToRenderers(
71 event_name, json_args, profile->IsOffTheRecord(), GURL()); 71 event_name, json_args, profile, GURL());
72 } 72 }
73 } 73 }
74 74
75 static void DispatchEventWithTab(Profile* profile, 75 static void DispatchEventWithTab(Profile* profile,
76 const char* event_name, 76 const char* event_name,
77 const TabContents* tab_contents) { 77 const TabContents* tab_contents) {
78 ListValue args; 78 ListValue args;
79 args.Append(ExtensionTabUtil::CreateTabValue(tab_contents)); 79 args.Append(ExtensionTabUtil::CreateTabValue(tab_contents));
80 std::string json_args; 80 std::string json_args;
81 base::JSONWriter::Write(&args, false, &json_args); 81 base::JSONWriter::Write(&args, false, &json_args);
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 void ExtensionBrowserEventRouter::BrowserActionExecuted( 472 void ExtensionBrowserEventRouter::BrowserActionExecuted(
473 Profile* profile, const std::string& extension_id, Browser* browser) { 473 Profile* profile, const std::string& extension_id, Browser* browser) {
474 TabContents* tab_contents = NULL; 474 TabContents* tab_contents = NULL;
475 int tab_id = 0; 475 int tab_id = 0;
476 if (!ExtensionTabUtil::GetDefaultTab(browser, &tab_contents, &tab_id)) 476 if (!ExtensionTabUtil::GetDefaultTab(browser, &tab_contents, &tab_id))
477 return; 477 return;
478 std::string event_name = ExtensionMessageService::GetPerExtensionEventName( 478 std::string event_name = ExtensionMessageService::GetPerExtensionEventName(
479 "browserAction.onClicked", extension_id); 479 "browserAction.onClicked", extension_id);
480 DispatchEventWithTab(profile, event_name.c_str(), tab_contents); 480 DispatchEventWithTab(profile, event_name.c_str(), tab_contents);
481 } 481 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_bookmarks_module.cc ('k') | chrome/browser/extensions/extension_cookies_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698