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

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

Issue 10066013: [protector] Homepage UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added pyauto tests. Created 8 years, 8 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 "chrome/browser/protector/protector_service.h" 5 #include "chrome/browser/protector/protector_service.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/google/google_util.h" 8 #include "chrome/browser/google/google_util.h"
9 #include "chrome/browser/prefs/pref_service.h" 9 #include "chrome/browser/prefs/pref_service.h"
10 #include "chrome/browser/protector/composite_settings_change.h" 10 #include "chrome/browser/protector/composite_settings_change.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 BaseSettingChange* existing_change = item_to_merge_with->change.release(); 65 BaseSettingChange* existing_change = item_to_merge_with->change.release();
66 CompositeSettingsChange* merged_change = 66 CompositeSettingsChange* merged_change =
67 existing_change->MergeWith(change_ptr.release()); 67 existing_change->MergeWith(change_ptr.release());
68 item_to_merge_with->change.reset(merged_change); 68 item_to_merge_with->change.reset(merged_change);
69 item_to_merge_with->was_merged = true; 69 item_to_merge_with->was_merged = true;
70 if (item_to_merge_with->error->GetBubbleView()) 70 if (item_to_merge_with->error->GetBubbleView())
71 item_to_merge_with->show_when_merged = true; 71 item_to_merge_with->show_when_merged = true;
72 // Remove old GlobalError instance. Later in OnRemovedFromProfile() a new 72 // Remove old GlobalError instance. Later in OnRemovedFromProfile() a new
73 // GlobalError instance will be created for the composite change. 73 // GlobalError instance will be created for the composite change.
74 item_to_merge_with->error->RemoveFromProfile(); 74 item_to_merge_with->error->RemoveFromProfile();
75 } else { 75 } else if (change->IsUserVisible()) {
76 Item new_item; 76 Item new_item;
77 SettingsChangeGlobalError* error = 77 SettingsChangeGlobalError* error =
78 new SettingsChangeGlobalError(change_ptr.get(), this); 78 new SettingsChangeGlobalError(change_ptr.get(), this);
79 new_item.error.reset(error); 79 new_item.error.reset(error);
80 new_item.change.reset(change_ptr.release()); 80 new_item.change.reset(change_ptr.release());
81 items_.push_back(new_item); 81 items_.push_back(new_item);
82 // Do not show the bubble immediately if another one is active. 82 // Do not show the bubble immediately if another one is active.
83 error->AddToProfile(profile_, !has_active_change_); 83 error->AddToProfile(profile_, !has_active_change_);
84 has_active_change_ = true; 84 has_active_change_ = true;
85 } else {
86 VLOG(1) << "Not showing a change because it's not user-visible.";
85 } 87 }
86 } 88 }
87 89
88 bool ProtectorService::IsShowingChange() const { 90 bool ProtectorService::IsShowingChange() const {
89 return !items_.empty(); 91 return !items_.empty();
90 } 92 }
91 93
92 void ProtectorService::ApplyChange(BaseSettingChange* change, 94 void ProtectorService::ApplyChange(BaseSettingChange* change,
93 Browser* browser) { 95 Browser* browser) {
94 change->Apply(browser); 96 change->Apply(browser);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 ProtectorService::MatchItemByError::MatchItemByError( 212 ProtectorService::MatchItemByError::MatchItemByError(
211 const SettingsChangeGlobalError* other) : other_(other) { 213 const SettingsChangeGlobalError* other) : other_(other) {
212 } 214 }
213 215
214 bool ProtectorService::MatchItemByError::operator()( 216 bool ProtectorService::MatchItemByError::operator()(
215 const ProtectorService::Item& item) { 217 const ProtectorService::Item& item) {
216 return other_ == item.error.get(); 218 return other_ == item.error.get();
217 } 219 }
218 220
219 } // namespace protector 221 } // namespace protector
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698