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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
11 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 11 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
12 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 12 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
13 #include "chrome/browser/password_manager/password_store_factory.h" | 13 #include "chrome/browser/password_manager/password_store_factory.h" |
14 #include "chrome/browser/ui/browser_command_controller.h" | 14 #include "chrome/browser/ui/browser_command_controller.h" |
15 #include "chrome/browser/ui/browser_finder.h" | 15 #include "chrome/browser/ui/browser_finder.h" |
16 #include "chrome/browser/ui/browser_navigator_params.h" | 16 #include "chrome/browser/ui/browser_navigator_params.h" |
17 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
18 #include "chrome/browser/ui/chrome_pages.h" | 18 #include "chrome/browser/ui/chrome_pages.h" |
19 #include "chrome/browser/ui/desktop_ios_promotion/desktop_ios_promotion.h" | |
20 #include "chrome/browser/ui/desktop_ios_promotion/desktop_ios_promotion_controll er.h" | |
21 #include "chrome/browser/ui/desktop_ios_promotion/desktop_ios_promotion_util.h" | |
19 #include "chrome/browser/ui/location_bar/location_bar.h" | 22 #include "chrome/browser/ui/location_bar/location_bar.h" |
20 #include "chrome/browser/ui/passwords/manage_passwords_icon_view.h" | 23 #include "chrome/browser/ui/passwords/manage_passwords_icon_view.h" |
21 #include "chrome/browser/ui/passwords/password_dialog_controller_impl.h" | 24 #include "chrome/browser/ui/passwords/password_dialog_controller_impl.h" |
22 #include "chrome/browser/ui/passwords/password_dialog_prompts.h" | 25 #include "chrome/browser/ui/passwords/password_dialog_prompts.h" |
23 #include "chrome/browser/ui/tab_dialogs.h" | 26 #include "chrome/browser/ui/tab_dialogs.h" |
24 #include "chrome/common/url_constants.h" | 27 #include "chrome/common/url_constants.h" |
25 #include "components/password_manager/core/browser/browser_save_password_progres s_logger.h" | 28 #include "components/password_manager/core/browser/browser_save_password_progres s_logger.h" |
26 #include "components/password_manager/core/browser/password_bubble_experiment.h" | 29 #include "components/password_manager/core/browser/password_bubble_experiment.h" |
27 #include "components/password_manager/core/browser/password_form_manager.h" | 30 #include "components/password_manager/core/browser/password_form_manager.h" |
28 #include "components/password_manager/core/browser/password_manager_constants.h" | 31 #include "components/password_manager/core/browser/password_manager_constants.h" |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
316 credential_type); | 319 credential_type); |
317 // Copy the argument before destroying the controller. |form| is a member of | 320 // Copy the argument before destroying the controller. |form| is a member of |
318 // |dialog_controller_|. | 321 // |dialog_controller_|. |
319 autofill::PasswordForm copy_form = form; | 322 autofill::PasswordForm copy_form = form; |
320 dialog_controller_.reset(); | 323 dialog_controller_.reset(); |
321 passwords_data_.ChooseCredential(©_form); | 324 passwords_data_.ChooseCredential(©_form); |
322 passwords_data_.TransitionToState(password_manager::ui::MANAGE_STATE); | 325 passwords_data_.TransitionToState(password_manager::ui::MANAGE_STATE); |
323 UpdateBubbleAndIconVisibility(); | 326 UpdateBubbleAndIconVisibility(); |
324 } | 327 } |
325 | 328 |
329 DesktopIOSPromotion* ManagePasswordsUIController::GetDesktopIOSPromotion() { | |
330 return CreateDesktopIOSPromotion(); | |
sky
2017/02/17 00:57:23
Why does this always call Create? I wouldn't expec
mrefaat
2017/02/17 04:31:49
removed it.
| |
331 } | |
332 | |
326 void ManagePasswordsUIController::NavigateToSmartLockHelpPage() { | 333 void ManagePasswordsUIController::NavigateToSmartLockHelpPage() { |
327 chrome::NavigateParams params( | 334 chrome::NavigateParams params( |
328 chrome::FindBrowserWithWebContents(web_contents()), | 335 chrome::FindBrowserWithWebContents(web_contents()), |
329 GURL(chrome::kSmartLockHelpPage), ui::PAGE_TRANSITION_LINK); | 336 GURL(chrome::kSmartLockHelpPage), ui::PAGE_TRANSITION_LINK); |
330 params.disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB; | 337 params.disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB; |
331 chrome::Navigate(¶ms); | 338 chrome::Navigate(¶ms); |
332 } | 339 } |
333 | 340 |
334 void ManagePasswordsUIController::NavigateToPasswordManagerSettingsPage() { | 341 void ManagePasswordsUIController::NavigateToPasswordManagerSettingsPage() { |
335 chrome::ShowSettingsSubPage( | 342 chrome::ShowSettingsSubPage( |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
393 LocationBar* location_bar = browser->window()->GetLocationBar(); | 400 LocationBar* location_bar = browser->window()->GetLocationBar(); |
394 DCHECK(location_bar); | 401 DCHECK(location_bar); |
395 location_bar->UpdateManagePasswordsIconAndBubble(); | 402 location_bar->UpdateManagePasswordsIconAndBubble(); |
396 } | 403 } |
397 | 404 |
398 AccountChooserPrompt* ManagePasswordsUIController::CreateAccountChooser( | 405 AccountChooserPrompt* ManagePasswordsUIController::CreateAccountChooser( |
399 PasswordDialogController* controller) { | 406 PasswordDialogController* controller) { |
400 return CreateAccountChooserPromptView(controller, web_contents()); | 407 return CreateAccountChooserPromptView(controller, web_contents()); |
401 } | 408 } |
402 | 409 |
410 DesktopIOSPromotion* ManagePasswordsUIController::CreateDesktopIOSPromotion() { | |
411 ios_promotion_controller_.reset(new DesktopIOSPromotionController( | |
412 Profile::FromBrowserContext(web_contents()->GetBrowserContext()), | |
413 desktop_ios_promotion::PromotionEntryPoint::SAVE_PASSWORD_BUBBLE)); | |
414 return CreateDesktopIOSPromotionView(ios_promotion_controller_.get()); | |
415 } | |
416 | |
403 AutoSigninFirstRunPrompt* ManagePasswordsUIController::CreateAutoSigninPrompt( | 417 AutoSigninFirstRunPrompt* ManagePasswordsUIController::CreateAutoSigninPrompt( |
404 PasswordDialogController* controller) { | 418 PasswordDialogController* controller) { |
405 return CreateAutoSigninPromptView(controller, web_contents()); | 419 return CreateAutoSigninPromptView(controller, web_contents()); |
406 } | 420 } |
407 | 421 |
408 bool ManagePasswordsUIController::HasBrowserWindow() const { | 422 bool ManagePasswordsUIController::HasBrowserWindow() const { |
409 return chrome::FindBrowserWithWebContents(web_contents()) != nullptr; | 423 return chrome::FindBrowserWithWebContents(web_contents()) != nullptr; |
410 } | 424 } |
411 | 425 |
412 void ManagePasswordsUIController::DidFinishNavigation( | 426 void ManagePasswordsUIController::DidFinishNavigation( |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
449 passwords_data_.TransitionToState(password_manager::ui::MANAGE_STATE); | 463 passwords_data_.TransitionToState(password_manager::ui::MANAGE_STATE); |
450 } | 464 } |
451 } | 465 } |
452 | 466 |
453 void ManagePasswordsUIController::WebContentsDestroyed() { | 467 void ManagePasswordsUIController::WebContentsDestroyed() { |
454 password_manager::PasswordStore* password_store = | 468 password_manager::PasswordStore* password_store = |
455 GetPasswordStore(web_contents()); | 469 GetPasswordStore(web_contents()); |
456 if (password_store) | 470 if (password_store) |
457 password_store->RemoveObserver(this); | 471 password_store->RemoveObserver(this); |
458 } | 472 } |
OLD | NEW |