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

Side by Side Diff: chrome/browser/extensions/api/web_navigation/web_navigation_api_helpers.cc

Issue 11232066: Remove GetExtensionEventRouter from Profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rerebase Created 8 years, 1 month 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) 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 // Implements the Chrome Extensions WebNavigation API. 5 // Implements the Chrome Extensions WebNavigation API.
6 6
7 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api_helper s.h" 7 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api_helper s.h"
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
11 #include "base/time.h" 11 #include "base/time.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api_consta nts.h" 13 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api_consta nts.h"
14 #include "chrome/browser/extensions/event_router.h" 14 #include "chrome/browser/extensions/event_router.h"
15 #include "chrome/browser/extensions/extension_system.h"
15 #include "chrome/browser/extensions/extension_tab_util.h" 16 #include "chrome/browser/extensions/extension_tab_util.h"
16 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/common/extensions/event_filtering_info.h" 18 #include "chrome/common/extensions/event_filtering_info.h"
18 #include "content/public/browser/render_process_host.h" 19 #include "content/public/browser/render_process_host.h"
19 #include "content/public/browser/render_view_host.h" 20 #include "content/public/browser/render_view_host.h"
20 #include "content/public/browser/web_contents.h" 21 #include "content/public/browser/web_contents.h"
21 #include "net/base/net_errors.h" 22 #include "net/base/net_errors.h"
22 23
23 namespace extensions { 24 namespace extensions {
24 25
(...skipping 10 matching lines...) Expand all
35 36
36 // Dispatches events to the extension message service. 37 // Dispatches events to the extension message service.
37 void DispatchEvent(content::BrowserContext* browser_context, 38 void DispatchEvent(content::BrowserContext* browser_context,
38 const char* event_name, 39 const char* event_name,
39 scoped_ptr<ListValue> args, 40 scoped_ptr<ListValue> args,
40 const GURL& url) { 41 const GURL& url) {
41 EventFilteringInfo info; 42 EventFilteringInfo info;
42 info.SetURL(url); 43 info.SetURL(url);
43 44
44 Profile* profile = Profile::FromBrowserContext(browser_context); 45 Profile* profile = Profile::FromBrowserContext(browser_context);
45 if (profile && profile->GetExtensionEventRouter()) { 46 if (profile && extensions::ExtensionSystem::Get(profile)->event_router()) {
46 profile->GetExtensionEventRouter()->DispatchEventToRenderers( 47 extensions::ExtensionSystem::Get(profile)->event_router()->
47 event_name, args.Pass(), profile, GURL(), info); 48 DispatchEventToRenderers(event_name, args.Pass(), profile, GURL(),
49 info);
48 } 50 }
49 } 51 }
50 52
51 } // namespace 53 } // namespace
52 54
53 int GetFrameId(bool is_main_frame, int64 frame_id) { 55 int GetFrameId(bool is_main_frame, int64 frame_id) {
54 return is_main_frame ? 0 : static_cast<int>(frame_id); 56 return is_main_frame ? 0 : static_cast<int>(frame_id);
55 } 57 }
56 58
57 // Constructs and dispatches an onBeforeNavigate event. 59 // Constructs and dispatches an onBeforeNavigate event.
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 ExtensionTabUtil::GetTabId(new_web_contents)); 225 ExtensionTabUtil::GetTabId(new_web_contents));
224 dict->SetDouble(keys::kTimeStampKey, MilliSecondsFromTime(base::Time::Now())); 226 dict->SetDouble(keys::kTimeStampKey, MilliSecondsFromTime(base::Time::Now()));
225 args->Append(dict); 227 args->Append(dict);
226 228
227 DispatchEvent(browser_context, keys::kOnTabReplaced, args.Pass(), GURL()); 229 DispatchEvent(browser_context, keys::kOnTabReplaced, args.Pass(), GURL());
228 } 230 }
229 231
230 } // namespace web_navigation_api_helpers 232 } // namespace web_navigation_api_helpers
231 233
232 } // namespace extensions 234 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/terminal/terminal_private_api.cc ('k') | chrome/browser/extensions/bluetooth_event_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698