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

Side by Side Diff: chrome/browser/autofill/autofill_manager.cc

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit Created 8 years, 1 month 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/autofill/autofill_manager.h" 5 #include "chrome/browser/autofill/autofill_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <map> 10 #include <map>
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 new_renderer) { 283 new_renderer) {
284 password_generation_enabled_ = new_password_generation_enabled; 284 password_generation_enabled_ = new_password_generation_enabled;
285 SendPasswordGenerationStateToRenderer(host, password_generation_enabled_); 285 SendPasswordGenerationStateToRenderer(host, password_generation_enabled_);
286 } 286 }
287 } 287 }
288 288
289 void AutofillManager::RenderViewCreated(content::RenderViewHost* host) { 289 void AutofillManager::RenderViewCreated(content::RenderViewHost* host) {
290 UpdatePasswordGenerationState(host, true); 290 UpdatePasswordGenerationState(host, true);
291 } 291 }
292 292
293 void AutofillManager::Observe( 293 void AutofillManager::OnPreferenceChanged(PrefServiceBase* service,
294 int type, 294 const std::string& pref_name) {
295 const content::NotificationSource& source,
296 const content::NotificationDetails& details) {
297 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 295 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
298 DCHECK_EQ(chrome::NOTIFICATION_PREF_CHANGED, type); 296 DCHECK(prefs::kPasswordGenerationEnabled == pref_name);
299 std::string* pref = content::Details<std::string>(details).ptr();
300 DCHECK(prefs::kPasswordGenerationEnabled == *pref);
301 UpdatePasswordGenerationState(web_contents()->GetRenderViewHost(), false); 297 UpdatePasswordGenerationState(web_contents()->GetRenderViewHost(), false);
302 } 298 }
303 299
304 void AutofillManager::OnStateChanged() { 300 void AutofillManager::OnStateChanged() {
305 // It is possible for sync state to change during tab contents destruction. 301 // It is possible for sync state to change during tab contents destruction.
306 // In this case, we don't need to update the renderer since it's going away. 302 // In this case, we don't need to update the renderer since it's going away.
307 if (web_contents() && web_contents()->GetRenderViewHost()) { 303 if (web_contents() && web_contents()->GetRenderViewHost()) {
308 UpdatePasswordGenerationState(web_contents()->GetRenderViewHost(), 304 UpdatePasswordGenerationState(web_contents()->GetRenderViewHost(),
309 false); 305 false);
310 } 306 }
(...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1412 *profile_guid = IDToGUID(profile_id); 1408 *profile_guid = IDToGUID(profile_id);
1413 } 1409 }
1414 1410
1415 void AutofillManager::UpdateInitialInteractionTimestamp( 1411 void AutofillManager::UpdateInitialInteractionTimestamp(
1416 const TimeTicks& interaction_timestamp) { 1412 const TimeTicks& interaction_timestamp) {
1417 if (initial_interaction_timestamp_.is_null() || 1413 if (initial_interaction_timestamp_.is_null() ||
1418 interaction_timestamp < initial_interaction_timestamp_) { 1414 interaction_timestamp < initial_interaction_timestamp_) {
1419 initial_interaction_timestamp_ = interaction_timestamp; 1415 initial_interaction_timestamp_ = interaction_timestamp;
1420 } 1416 }
1421 } 1417 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_manager.h ('k') | chrome/browser/background/background_mode_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698