| 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 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | 5 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 } | 343 } |
| 344 ExtensionActionExecuted(context, page_action, web_contents); | 344 ExtensionActionExecuted(context, page_action, web_contents); |
| 345 } | 345 } |
| 346 | 346 |
| 347 // static | 347 // static |
| 348 void ExtensionActionAPI::DispatchEventToExtension( | 348 void ExtensionActionAPI::DispatchEventToExtension( |
| 349 content::BrowserContext* context, | 349 content::BrowserContext* context, |
| 350 const std::string& extension_id, | 350 const std::string& extension_id, |
| 351 const std::string& event_name, | 351 const std::string& event_name, |
| 352 scoped_ptr<base::ListValue> event_args) { | 352 scoped_ptr<base::ListValue> event_args) { |
| 353 if (!extensions::ExtensionSystem::Get(context)->event_router()) | 353 if (!extensions::EventRouter::Get(context)) |
| 354 return; | 354 return; |
| 355 | 355 |
| 356 scoped_ptr<Event> event(new Event(event_name, event_args.Pass())); | 356 scoped_ptr<Event> event(new Event(event_name, event_args.Pass())); |
| 357 event->restrict_to_browser_context = context; | 357 event->restrict_to_browser_context = context; |
| 358 event->user_gesture = EventRouter::USER_GESTURE_ENABLED; | 358 event->user_gesture = EventRouter::USER_GESTURE_ENABLED; |
| 359 ExtensionSystem::Get(context)->event_router()->DispatchEventToExtension( | 359 EventRouter::Get(context) |
| 360 extension_id, event.Pass()); | 360 ->DispatchEventToExtension(extension_id, event.Pass()); |
| 361 } | 361 } |
| 362 | 362 |
| 363 // static | 363 // static |
| 364 void ExtensionActionAPI::DispatchOldPageActionEvent( | 364 void ExtensionActionAPI::DispatchOldPageActionEvent( |
| 365 content::BrowserContext* context, | 365 content::BrowserContext* context, |
| 366 const std::string& extension_id, | 366 const std::string& extension_id, |
| 367 const std::string& page_action_id, | 367 const std::string& page_action_id, |
| 368 int tab_id, | 368 int tab_id, |
| 369 const std::string& url, | 369 const std::string& url, |
| 370 int button) { | 370 int button) { |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 return true; | 920 return true; |
| 921 } | 921 } |
| 922 | 922 |
| 923 bool EnablePageActionsFunction::RunImpl() { | 923 bool EnablePageActionsFunction::RunImpl() { |
| 924 return SetPageActionEnabled(true); | 924 return SetPageActionEnabled(true); |
| 925 } | 925 } |
| 926 | 926 |
| 927 bool DisablePageActionsFunction::RunImpl() { | 927 bool DisablePageActionsFunction::RunImpl() { |
| 928 return SetPageActionEnabled(false); | 928 return SetPageActionEnabled(false); |
| 929 } | 929 } |
| OLD | NEW |