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/passwords/manage_passwords_ui_controller.h" | 5 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" |
6 | 6 |
7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
8 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 8 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/password_manager/password_store_factory.h" | 10 #include "chrome/browser/password_manager/password_store_factory.h" |
11 #include "chrome/browser/ui/browser_command_controller.h" | 11 #include "chrome/browser/ui/browser_command_controller.h" |
12 #include "chrome/browser/ui/browser_dialogs.h" | 12 #include "chrome/browser/ui/browser_dialogs.h" |
13 #include "chrome/browser/ui/browser_finder.h" | 13 #include "chrome/browser/ui/browser_finder.h" |
14 #include "chrome/browser/ui/browser_window.h" | 14 #include "chrome/browser/ui/browser_window.h" |
15 #include "chrome/browser/ui/chrome_pages.h" | 15 #include "chrome/browser/ui/chrome_pages.h" |
16 #include "chrome/browser/ui/location_bar/location_bar.h" | 16 #include "chrome/browser/ui/location_bar/location_bar.h" |
17 #include "chrome/browser/ui/passwords/manage_passwords_icon.h" | 17 #include "chrome/browser/ui/passwords/manage_passwords_icon.h" |
18 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
19 #include "components/password_manager/core/browser/password_store.h" | 19 #include "components/password_manager/core/browser/password_store.h" |
20 #include "content/public/browser/notification_service.h" | 20 #include "content/public/browser/notification_service.h" |
21 | 21 |
| 22 #if defined(OS_ANDROID) |
| 23 #include "chrome/browser/android/chromium_application.h" |
| 24 #endif |
| 25 |
22 using autofill::PasswordFormMap; | 26 using autofill::PasswordFormMap; |
23 using password_manager::PasswordFormManager; | 27 using password_manager::PasswordFormManager; |
24 | 28 |
25 namespace { | 29 namespace { |
26 | 30 |
27 password_manager::PasswordStore* GetPasswordStore( | 31 password_manager::PasswordStore* GetPasswordStore( |
28 content::WebContents* web_contents) { | 32 content::WebContents* web_contents) { |
29 return PasswordStoreFactory::GetForProfile( | 33 return PasswordStoreFactory::GetForProfile( |
30 Profile::FromBrowserContext(web_contents->GetBrowserContext()), | 34 Profile::FromBrowserContext(web_contents->GetBrowserContext()), |
31 Profile::EXPLICIT_ACCESS).get(); | 35 Profile::EXPLICIT_ACCESS).get(); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 if (changed_form.blacklisted_by_user) | 155 if (changed_form.blacklisted_by_user) |
152 state_ = password_manager::ui::BLACKLIST_STATE; | 156 state_ = password_manager::ui::BLACKLIST_STATE; |
153 } | 157 } |
154 } | 158 } |
155 if (current_state != state_) | 159 if (current_state != state_) |
156 UpdateBubbleAndIconVisibility(); | 160 UpdateBubbleAndIconVisibility(); |
157 } | 161 } |
158 | 162 |
159 void ManagePasswordsUIController:: | 163 void ManagePasswordsUIController:: |
160 NavigateToPasswordManagerSettingsPage() { | 164 NavigateToPasswordManagerSettingsPage() { |
161 // TODO(mkwst): chrome_pages.h is compiled out of Android. Need to figure out | 165 #if defined(OS_ANDROID) |
162 // how this navigation should work there. | 166 chrome::android::ChromiumApplication::ShowPasswordSettings(); |
163 #if !defined(OS_ANDROID) | 167 #else |
164 chrome::ShowSettingsSubPage( | 168 chrome::ShowSettingsSubPage( |
165 chrome::FindBrowserWithWebContents(web_contents()), | 169 chrome::FindBrowserWithWebContents(web_contents()), |
166 chrome::kPasswordManagerSubPage); | 170 chrome::kPasswordManagerSubPage); |
167 #endif | 171 #endif |
168 } | 172 } |
169 | 173 |
170 void ManagePasswordsUIController::SavePassword() { | 174 void ManagePasswordsUIController::SavePassword() { |
171 DCHECK(PasswordPendingUserDecision()); | 175 DCHECK(PasswordPendingUserDecision()); |
172 SavePasswordInternal(); | 176 SavePasswordInternal(); |
173 state_ = password_manager::ui::MANAGE_STATE; | 177 state_ = password_manager::ui::MANAGE_STATE; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 return; | 270 return; |
267 CommandUpdater* updater = browser->command_controller()->command_updater(); | 271 CommandUpdater* updater = browser->command_controller()->command_updater(); |
268 updater->ExecuteCommand(IDC_MANAGE_PASSWORDS_FOR_PAGE); | 272 updater->ExecuteCommand(IDC_MANAGE_PASSWORDS_FOR_PAGE); |
269 #endif | 273 #endif |
270 } | 274 } |
271 | 275 |
272 bool ManagePasswordsUIController::PasswordPendingUserDecision() const { | 276 bool ManagePasswordsUIController::PasswordPendingUserDecision() const { |
273 return state_ == password_manager::ui::PENDING_PASSWORD_STATE || | 277 return state_ == password_manager::ui::PENDING_PASSWORD_STATE || |
274 state_ == password_manager::ui::PENDING_PASSWORD_AND_BUBBLE_STATE; | 278 state_ == password_manager::ui::PENDING_PASSWORD_AND_BUBBLE_STATE; |
275 } | 279 } |
OLD | NEW |