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

Side by Side Diff: chrome/browser/extensions/api/omnibox/omnibox_api.cc

Issue 10880064: Make extension commands grant the activeTab permission. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 8 years, 3 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/api/omnibox/omnibox_api.h" 5 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 TabContents* tab_contents, 78 TabContents* tab_contents,
79 const std::string& extension_id, 79 const std::string& extension_id,
80 const std::string& input) { 80 const std::string& input) {
81 Profile* profile = tab_contents->profile(); 81 Profile* profile = tab_contents->profile();
82 82
83 const Extension* extension = 83 const Extension* extension =
84 ExtensionSystem::Get(profile)->extension_service()->extensions()-> 84 ExtensionSystem::Get(profile)->extension_service()->extensions()->
85 GetByID(extension_id); 85 GetByID(extension_id);
86 CHECK(extension); 86 CHECK(extension);
87 extensions::TabHelper::FromWebContents(tab_contents->web_contents())-> 87 extensions::TabHelper::FromWebContents(tab_contents->web_contents())->
88 active_tab_permission_manager()->GrantIfRequested(extension); 88 active_tab_permission_granter()->GrantIfRequested(extension);
89 89
90 scoped_ptr<ListValue> args(new ListValue()); 90 scoped_ptr<ListValue> args(new ListValue());
91 args->Set(0, Value::CreateStringValue(input)); 91 args->Set(0, Value::CreateStringValue(input));
92 92
93 profile->GetExtensionEventRouter()->DispatchEventToExtension( 93 profile->GetExtensionEventRouter()->DispatchEventToExtension(
94 extension_id, events::kOnInputEntered, args.Pass(), profile, GURL()); 94 extension_id, events::kOnInputEntered, args.Pass(), profile, GURL());
95 95
96 content::NotificationService::current()->Notify( 96 content::NotificationService::current()->Notify(
97 chrome::NOTIFICATION_EXTENSION_OMNIBOX_INPUT_ENTERED, 97 chrome::NOTIFICATION_EXTENSION_OMNIBOX_INPUT_ENTERED,
98 content::Source<Profile>(profile), 98 content::Source<Profile>(profile),
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 for (size_t i = 0; i < description_styles.size(); ++i) { 301 for (size_t i = 0; i < description_styles.size(); ++i) {
302 if (description_styles[i].offset > placeholder) 302 if (description_styles[i].offset > placeholder)
303 description_styles[i].offset += replacement.length() - 2; 303 description_styles[i].offset += replacement.length() - 2;
304 } 304 }
305 } 305 }
306 306
307 match->contents.assign(description); 307 match->contents.assign(description);
308 } 308 }
309 309
310 } // namespace extensions 310 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/active_tab_unittest.cc ('k') | chrome/browser/extensions/extension_keybinding_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698