| OLD | NEW |
| 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/ui/webui/password_manager_internals/password_manager_in
ternals_ui.h" | 5 #include "chrome/browser/ui/webui/password_manager_internals/password_manager_in
ternals_ui.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 ResetAutoSignInFirstRunExperience(); | 92 ResetAutoSignInFirstRunExperience(); |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 void PasswordManagerInternalsUI::LogSavePasswordProgress( | 96 void PasswordManagerInternalsUI::LogSavePasswordProgress( |
| 97 const std::string& text) { | 97 const std::string& text) { |
| 98 if (!registered_with_logging_service_ || text.empty()) | 98 if (!registered_with_logging_service_ || text.empty()) |
| 99 return; | 99 return; |
| 100 std::string no_quotes(text); | 100 std::string no_quotes(text); |
| 101 std::replace(no_quotes.begin(), no_quotes.end(), '"', ' '); | 101 std::replace(no_quotes.begin(), no_quotes.end(), '"', ' '); |
| 102 base::StringValue text_string_value(net::EscapeForHTML(no_quotes)); | 102 base::Value text_string_value(net::EscapeForHTML(no_quotes)); |
| 103 web_ui()->CallJavascriptFunctionUnsafe("addSavePasswordProgressLog", | 103 web_ui()->CallJavascriptFunctionUnsafe("addSavePasswordProgressLog", |
| 104 text_string_value); | 104 text_string_value); |
| 105 } | 105 } |
| 106 | 106 |
| 107 void PasswordManagerInternalsUI::UnregisterFromLoggingServiceIfNecessary() { | 107 void PasswordManagerInternalsUI::UnregisterFromLoggingServiceIfNecessary() { |
| 108 if (!registered_with_logging_service_) | 108 if (!registered_with_logging_service_) |
| 109 return; | 109 return; |
| 110 registered_with_logging_service_ = false; | 110 registered_with_logging_service_ = false; |
| 111 PasswordManagerInternalsService* service = | 111 PasswordManagerInternalsService* service = |
| 112 PasswordManagerInternalsServiceFactory::GetForBrowserContext( | 112 PasswordManagerInternalsServiceFactory::GetForBrowserContext( |
| 113 Profile::FromWebUI(web_ui())); | 113 Profile::FromWebUI(web_ui())); |
| 114 if (service) | 114 if (service) |
| 115 service->UnregisterReceiver(this); | 115 service->UnregisterReceiver(this); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void PasswordManagerInternalsUI::ResetAutoSignInFirstRunExperience() { | 118 void PasswordManagerInternalsUI::ResetAutoSignInFirstRunExperience() { |
| 119 Profile* profile = Profile::FromWebUI(web_ui()); | 119 Profile* profile = Profile::FromWebUI(web_ui()); |
| 120 if (profile->GetProfileType() == Profile::REGULAR_PROFILE) { | 120 if (profile->GetProfileType() == Profile::REGULAR_PROFILE) { |
| 121 profile->GetPrefs()->SetBoolean( | 121 profile->GetPrefs()->SetBoolean( |
| 122 password_manager::prefs::kWasAutoSignInFirstRunExperienceShown, false); | 122 password_manager::prefs::kWasAutoSignInFirstRunExperienceShown, false); |
| 123 | 123 |
| 124 PasswordManagerInternalsService* service = | 124 PasswordManagerInternalsService* service = |
| 125 PasswordManagerInternalsServiceFactory::GetForBrowserContext( | 125 PasswordManagerInternalsServiceFactory::GetForBrowserContext( |
| 126 Profile::FromWebUI(web_ui())); | 126 Profile::FromWebUI(web_ui())); |
| 127 if (service) | 127 if (service) |
| 128 service->ProcessLog("Reset auto sign-in first run experience: yes"); | 128 service->ProcessLog("Reset auto sign-in first run experience: yes"); |
| 129 } | 129 } |
| 130 } | 130 } |
| OLD | NEW |