| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/autocomplete/keyword_extensions_delegate_impl.h" | 5 #include "chrome/browser/autocomplete/keyword_extensions_delegate_impl.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" | 8 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/extension_util.h" | 10 #include "chrome/browser/extensions/extension_util.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "content/public/browser/notification_details.h" | 12 #include "content/public/browser/notification_details.h" |
| 13 #include "content/public/browser/notification_source.h" | 13 #include "content/public/browser/notification_source.h" |
| 14 #include "extensions/browser/extension_system.h" | 14 #include "extensions/browser/extension_registry.h" |
| 15 #include "extensions/browser/notification_types.h" | 15 #include "extensions/browser/notification_types.h" |
| 16 | 16 |
| 17 namespace omnibox_api = extensions::api::omnibox; | 17 namespace omnibox_api = extensions::api::omnibox; |
| 18 | 18 |
| 19 int KeywordExtensionsDelegateImpl::global_input_uid_ = 0; | 19 int KeywordExtensionsDelegateImpl::global_input_uid_ = 0; |
| 20 | 20 |
| 21 KeywordExtensionsDelegateImpl::KeywordExtensionsDelegateImpl( | 21 KeywordExtensionsDelegateImpl::KeywordExtensionsDelegateImpl( |
| 22 Profile* profile, | 22 Profile* profile, |
| 23 KeywordProvider* provider) | 23 KeywordProvider* provider) |
| 24 : KeywordExtensionsDelegate(provider), | 24 : KeywordExtensionsDelegate(provider), |
| (...skipping 19 matching lines...) Expand all Loading... |
| 44 | 44 |
| 45 KeywordExtensionsDelegateImpl::~KeywordExtensionsDelegateImpl() { | 45 KeywordExtensionsDelegateImpl::~KeywordExtensionsDelegateImpl() { |
| 46 } | 46 } |
| 47 | 47 |
| 48 void KeywordExtensionsDelegateImpl::IncrementInputId() { | 48 void KeywordExtensionsDelegateImpl::IncrementInputId() { |
| 49 current_input_id_ = ++global_input_uid_; | 49 current_input_id_ = ++global_input_uid_; |
| 50 } | 50 } |
| 51 | 51 |
| 52 bool KeywordExtensionsDelegateImpl::IsEnabledExtension( | 52 bool KeywordExtensionsDelegateImpl::IsEnabledExtension( |
| 53 const std::string& extension_id) { | 53 const std::string& extension_id) { |
| 54 ExtensionService* extension_service = | |
| 55 extensions::ExtensionSystem::Get(profile_)->extension_service(); | |
| 56 const extensions::Extension* extension = | 54 const extensions::Extension* extension = |
| 57 extension_service->GetExtensionById(extension_id, false); | 55 extensions::ExtensionRegistry::Get( |
| 56 profile_)->enabled_extensions().GetByID(extension_id); |
| 58 return extension && | 57 return extension && |
| 59 (!profile_->IsOffTheRecord() || | 58 (!profile_->IsOffTheRecord() || |
| 60 extensions::util::IsIncognitoEnabled(extension_id, profile_)); | 59 extensions::util::IsIncognitoEnabled(extension_id, profile_)); |
| 61 } | 60 } |
| 62 | 61 |
| 63 bool KeywordExtensionsDelegateImpl::Start( | 62 bool KeywordExtensionsDelegateImpl::Start( |
| 64 const AutocompleteInput& input, | 63 const AutocompleteInput& input, |
| 65 bool minimal_changes, | 64 bool minimal_changes, |
| 66 const TemplateURL* template_url, | 65 const TemplateURL* template_url, |
| 67 const base::string16& remaining_input) { | 66 const base::string16& remaining_input) { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 203 |
| 205 default: | 204 default: |
| 206 NOTREACHED(); | 205 NOTREACHED(); |
| 207 return; | 206 return; |
| 208 } | 207 } |
| 209 } | 208 } |
| 210 | 209 |
| 211 void KeywordExtensionsDelegateImpl::OnProviderUpdate(bool updated_matches) { | 210 void KeywordExtensionsDelegateImpl::OnProviderUpdate(bool updated_matches) { |
| 212 provider_->listener_->OnProviderUpdate(updated_matches); | 211 provider_->listener_->OnProviderUpdate(updated_matches); |
| 213 } | 212 } |
| OLD | NEW |