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

Side by Side Diff: chrome/browser/protector/default_search_provider_change.cc

Issue 9500020: ProtectorService supports multiple change instances. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 8 years, 9 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 <algorithm> 5 #include <algorithm>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 } 328 }
329 } 329 }
330 330
331 void DefaultSearchProviderChange::OnTemplateURLServiceChanged() { 331 void DefaultSearchProviderChange::OnTemplateURLServiceChanged() {
332 TemplateURLService* url_service = GetTemplateURLService(); 332 TemplateURLService* url_service = GetTemplateURLService();
333 if (url_service->GetDefaultSearchProvider() != default_search_provider_) { 333 if (url_service->GetDefaultSearchProvider() != default_search_provider_) {
334 VLOG(1) << "Default search provider has been changed by user"; 334 VLOG(1) << "Default search provider has been changed by user";
335 default_search_provider_ = NULL; 335 default_search_provider_ = NULL;
336 url_service->RemoveObserver(this); 336 url_service->RemoveObserver(this);
337 // Will delete this DefaultSearchProviderChange instance. 337 // Will delete this DefaultSearchProviderChange instance.
338 ProtectorServiceFactory::GetForProfile(profile())->DismissChange(); 338 ProtectorServiceFactory::GetForProfile(profile())->DismissChange(this);
339 } 339 }
340 } 340 }
341 341
342 void DefaultSearchProviderChange::Observe( 342 void DefaultSearchProviderChange::Observe(
343 int type, 343 int type,
344 const content::NotificationSource& source, 344 const content::NotificationSource& source,
345 const content::NotificationDetails& details) { 345 const content::NotificationDetails& details) {
346 DCHECK(type == chrome::NOTIFICATION_TEMPLATE_URL_REMOVED); 346 DCHECK(type == chrome::NOTIFICATION_TEMPLATE_URL_REMOVED);
347 TemplateURLID id = *content::Details<TemplateURLID>(details).ptr(); 347 TemplateURLID id = *content::Details<TemplateURLID>(details).ptr();
348 if (id == new_id_) 348 if (id == new_id_)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 return url_service; 398 return url_service;
399 } 399 }
400 400
401 BaseSettingChange* CreateDefaultSearchProviderChange( 401 BaseSettingChange* CreateDefaultSearchProviderChange(
402 const TemplateURL* actual, 402 const TemplateURL* actual,
403 TemplateURL* backup) { 403 TemplateURL* backup) {
404 return new DefaultSearchProviderChange(actual, backup); 404 return new DefaultSearchProviderChange(actual, backup);
405 } 405 }
406 406
407 } // namespace protector 407 } // namespace protector
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698