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