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 // 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/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 void DispatchEvent(content::BrowserContext* browser_context, | 41 void DispatchEvent(content::BrowserContext* browser_context, |
42 const std::string& event_name, | 42 const std::string& event_name, |
43 scoped_ptr<base::ListValue> args, | 43 scoped_ptr<base::ListValue> args, |
44 const GURL& url) { | 44 const GURL& url) { |
45 EventFilteringInfo info; | 45 EventFilteringInfo info; |
46 info.SetURL(url); | 46 info.SetURL(url); |
47 | 47 |
48 Profile* profile = Profile::FromBrowserContext(browser_context); | 48 Profile* profile = Profile::FromBrowserContext(browser_context); |
49 EventRouter* event_router = EventRouter::Get(profile); | 49 EventRouter* event_router = EventRouter::Get(profile); |
50 if (profile && event_router) { | 50 if (profile && event_router) { |
51 scoped_ptr<Event> event(new Event(event_name, args.Pass())); | 51 scoped_ptr<Event> event( |
| 52 new Event(events::UNKNOWN, event_name, args.Pass())); |
52 event->restrict_to_browser_context = profile; | 53 event->restrict_to_browser_context = profile; |
53 event->filter_info = info; | 54 event->filter_info = info; |
54 event_router->BroadcastEvent(event.Pass()); | 55 event_router->BroadcastEvent(event.Pass()); |
55 } | 56 } |
56 } | 57 } |
57 | 58 |
58 } // namespace | 59 } // namespace |
59 | 60 |
60 int GetFrameId(content::RenderFrameHost* frame_host) { | 61 int GetFrameId(content::RenderFrameHost* frame_host) { |
61 if (!frame_host) | 62 if (!frame_host) |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 236 |
236 DispatchEvent(browser_context, | 237 DispatchEvent(browser_context, |
237 web_navigation::OnTabReplaced::kEventName, | 238 web_navigation::OnTabReplaced::kEventName, |
238 args.Pass(), | 239 args.Pass(), |
239 GURL()); | 240 GURL()); |
240 } | 241 } |
241 | 242 |
242 } // namespace web_navigation_api_helpers | 243 } // namespace web_navigation_api_helpers |
243 | 244 |
244 } // namespace extensions | 245 } // namespace extensions |
OLD | NEW |