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

Side by Side Diff: chrome/browser/autocomplete/keyword_extensions_delegate_impl.cc

Issue 545683003: Add a test for KeywordExtensionsDelegateImpl::IsEnabledExtension(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix409705
Patch Set: rebase to head where the fix for bug 409705 has gone in, address comments Created 6 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
« no previous file with comments | « no previous file | chrome/browser/autocomplete/keyword_extensions_delegate_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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(
Yoyo Zhou 2014/09/05 19:50:54 right, I should have noticed this.
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) {
68 DCHECK(template_url); 67 DCHECK(template_url);
69 68
70 if (input.want_asynchronous_matches()) { 69 if (input.want_asynchronous_matches()) {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autocomplete/keyword_extensions_delegate_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698