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

Side by Side Diff: chrome/browser/extensions/api/extension_action/extension_action_api.cc

Issue 148153008: Protocol handler dialogs should only be enabled by browser or page actions [Not committed] (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_function_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/browser/chrome_notification_types.h" 12 #include "chrome/browser/chrome_notification_types.h"
13 #include "chrome/browser/extensions/api/extension_action/extension_page_actions_ api_constants.h" 13 #include "chrome/browser/extensions/api/extension_action/extension_page_actions_ api_constants.h"
14 #include "chrome/browser/extensions/extension_action.h" 14 #include "chrome/browser/extensions/extension_action.h"
15 #include "chrome/browser/extensions/extension_action_manager.h" 15 #include "chrome/browser/extensions/extension_action_manager.h"
16 #include "chrome/browser/extensions/extension_function_registry.h" 16 #include "chrome/browser/extensions/extension_function_registry.h"
17 #include "chrome/browser/extensions/extension_host.h" 17 #include "chrome/browser/extensions/extension_host.h"
18 #include "chrome/browser/extensions/extension_service.h" 18 #include "chrome/browser/extensions/extension_service.h"
19 #include "chrome/browser/extensions/extension_system.h" 19 #include "chrome/browser/extensions/extension_system.h"
20 #include "chrome/browser/extensions/extension_tab_util.h" 20 #include "chrome/browser/extensions/extension_tab_util.h"
21 #include "chrome/browser/extensions/extension_toolbar_model.h" 21 #include "chrome/browser/extensions/extension_toolbar_model.h"
22 #include "chrome/browser/extensions/location_bar_controller.h" 22 #include "chrome/browser/extensions/location_bar_controller.h"
23 #include "chrome/browser/extensions/state_store.h" 23 #include "chrome/browser/extensions/state_store.h"
24 #include "chrome/browser/extensions/tab_helper.h" 24 #include "chrome/browser/extensions/tab_helper.h"
25 #include "chrome/browser/external_protocol/external_protocol_handler.h"
25 #include "chrome/browser/profiles/profile.h" 26 #include "chrome/browser/profiles/profile.h"
26 #include "chrome/common/extensions/api/extension_action/action_info.h" 27 #include "chrome/common/extensions/api/extension_action/action_info.h"
27 #include "chrome/common/render_messages.h" 28 #include "chrome/common/render_messages.h"
28 #include "content/public/browser/navigation_entry.h" 29 #include "content/public/browser/navigation_entry.h"
29 #include "content/public/browser/notification_service.h" 30 #include "content/public/browser/notification_service.h"
30 #include "extensions/browser/event_router.h" 31 #include "extensions/browser/event_router.h"
31 #include "extensions/common/error_utils.h" 32 #include "extensions/common/error_utils.h"
32 #include "ui/gfx/codec/png_codec.h" 33 #include "ui/gfx/codec/png_codec.h"
33 #include "ui/gfx/image/image.h" 34 #include "ui/gfx/image/image.h"
34 #include "ui/gfx/image/image_skia.h" 35 #include "ui/gfx/image/image_skia.h"
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 case ActionInfo::TYPE_BROWSER: 348 case ActionInfo::TYPE_BROWSER:
348 event_name = "browserAction.onClicked"; 349 event_name = "browserAction.onClicked";
349 break; 350 break;
350 case ActionInfo::TYPE_PAGE: 351 case ActionInfo::TYPE_PAGE:
351 event_name = "pageAction.onClicked"; 352 event_name = "pageAction.onClicked";
352 break; 353 break;
353 case ActionInfo::TYPE_SYSTEM_INDICATOR: 354 case ActionInfo::TYPE_SYSTEM_INDICATOR:
354 // The System Indicator handles its own clicks. 355 // The System Indicator handles its own clicks.
355 break; 356 break;
356 } 357 }
357 358 // Browser and page actions should enable launching external protocol
359 // handlers in the absence of any other user gesture.
360 ExternalProtocolHandler::PermitLaunchUrl();
Jeffrey Yasskin 2014/01/28 00:54:19 The other place I'd expect people to be relying on
meacer 2014/01/30 00:20:44 Just to clarify: If postMessage wasn't called from
358 if (event_name) { 361 if (event_name) {
359 scoped_ptr<base::ListValue> args(new base::ListValue()); 362 scoped_ptr<base::ListValue> args(new base::ListValue());
360 base::DictionaryValue* tab_value = 363 base::DictionaryValue* tab_value =
361 extensions::ExtensionTabUtil::CreateTabValue(web_contents); 364 extensions::ExtensionTabUtil::CreateTabValue(web_contents);
362 args->Append(tab_value); 365 args->Append(tab_value);
363 366
364 DispatchEventToExtension(profile, 367 DispatchEventToExtension(profile,
365 extension_action.extension_id(), 368 extension_action.extension_id(),
366 event_name, 369 event_name,
367 args.Pass()); 370 args.Pass());
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 return true; 923 return true;
921 } 924 }
922 925
923 bool EnablePageActionsFunction::RunImpl() { 926 bool EnablePageActionsFunction::RunImpl() {
924 return SetPageActionEnabled(true); 927 return SetPageActionEnabled(true);
925 } 928 }
926 929
927 bool DisablePageActionsFunction::RunImpl() { 930 bool DisablePageActionsFunction::RunImpl() {
928 return SetPageActionEnabled(false); 931 return SetPageActionEnabled(false);
929 } 932 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_function_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698