OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |