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

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

Issue 436703002: Revert external protocol handler user gesture fix on M36 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1985/src
Patch Set: Created 6 years, 4 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
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/active_tab_permission_granter.h" 5 #include "chrome/browser/extensions/active_tab_permission_granter.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "content/public/browser/navigation_details.h" 8 #include "content/public/browser/navigation_details.h"
9 #include "content/public/browser/navigation_entry.h" 9 #include "content/public/browser/navigation_entry.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
(...skipping 14 matching lines...) Expand all
25 Profile* profile) 25 Profile* profile)
26 : WebContentsObserver(web_contents), 26 : WebContentsObserver(web_contents),
27 tab_id_(tab_id), 27 tab_id_(tab_id),
28 extension_registry_observer_(this) { 28 extension_registry_observer_(this) {
29 extension_registry_observer_.Add(ExtensionRegistry::Get(profile)); 29 extension_registry_observer_.Add(ExtensionRegistry::Get(profile));
30 } 30 }
31 31
32 ActiveTabPermissionGranter::~ActiveTabPermissionGranter() {} 32 ActiveTabPermissionGranter::~ActiveTabPermissionGranter() {}
33 33
34 void ActiveTabPermissionGranter::GrantIfRequested(const Extension* extension) { 34 void ActiveTabPermissionGranter::GrantIfRequested(const Extension* extension) {
35 // Active tab grant request implies there was a user gesture.
36 web_contents()->UserGestureDone();
37
38 if (granted_extensions_.Contains(extension->id())) 35 if (granted_extensions_.Contains(extension->id()))
39 return; 36 return;
40 37
41 APIPermissionSet new_apis; 38 APIPermissionSet new_apis;
42 URLPatternSet new_hosts; 39 URLPatternSet new_hosts;
43 40
44 if (extension->HasAPIPermission(APIPermission::kActiveTab)) { 41 if (extension->HasAPIPermission(APIPermission::kActiveTab)) {
45 URLPattern pattern(UserScript::ValidUserScriptSchemes()); 42 URLPattern pattern(UserScript::ValidUserScriptSchemes());
46 // Pattern parsing could fail if this is an unsupported URL e.g. chrome://. 43 // Pattern parsing could fail if this is an unsupported URL e.g. chrome://.
47 if (pattern.Parse(web_contents()->GetURL().spec()) == 44 if (pattern.Parse(web_contents()->GetURL().spec()) ==
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 it != granted_extensions_.end(); ++it) { 103 it != granted_extensions_.end(); ++it) {
107 PermissionsData::ClearTabSpecificPermissions(it->get(), tab_id_); 104 PermissionsData::ClearTabSpecificPermissions(it->get(), tab_id_);
108 extension_ids.push_back((*it)->id()); 105 extension_ids.push_back((*it)->id());
109 } 106 }
110 107
111 Send(new ExtensionMsg_ClearTabSpecificPermissions(tab_id_, extension_ids)); 108 Send(new ExtensionMsg_ClearTabSpecificPermissions(tab_id_, extension_ids));
112 granted_extensions_.Clear(); 109 granted_extensions_.Clear();
113 } 110 }
114 111
115 } // namespace extensions 112 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_input.cc ('k') | chrome/browser/extensions/chrome_extensions_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698