| 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/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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 void ExtensionOmniboxEventRouter::OnInputEntered( | 77 void ExtensionOmniboxEventRouter::OnInputEntered( |
| 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 tab_contents->extension_tab_helper()->active_tab_permission_manager()-> | 87 extensions::TabHelper::FromWebContents(tab_contents->web_contents())-> |
| 88 GrantIfRequested(extension); | 88 active_tab_permission_manager()->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 Loading... |
| 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 |
| OLD | NEW |