Chromium Code Reviews| 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/views/tab_dialogs_views.h" | 5 #include "chrome/browser/ui/views/tab_dialogs_views.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" | 8 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" |
| 9 #include "chrome/browser/ui/views/collected_cookies_views.h" | 9 #include "chrome/browser/ui/views/collected_cookies_views.h" |
| 10 #include "chrome/browser/ui/views/hung_renderer_view.h" | 10 #include "chrome/browser/ui/views/hung_renderer_view.h" |
| 11 #include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h" | 11 #include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h" |
| 12 #include "chrome/browser/ui/views/sync/profile_signin_confirmation_dialog_views. h" | 12 #include "chrome/browser/ui/views/sync/profile_signin_confirmation_dialog_views. h" |
|
msw
2016/07/15 15:51:27
You'll need to only include this #if !defined(OS_C
Jane
2016/07/19 04:33:55
Done.
| |
| 13 #include "chrome/browser/ui/views/validation_message_bubble_view.h" | 13 #include "chrome/browser/ui/views/validation_message_bubble_view.h" |
| 14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 15 | 15 |
| 16 // static | 16 // static |
| 17 void TabDialogs::CreateForWebContents(content::WebContents* contents) { | 17 void TabDialogs::CreateForWebContents(content::WebContents* contents) { |
| 18 DCHECK(contents); | 18 DCHECK(contents); |
| 19 if (!FromWebContents(contents)) | 19 if (!FromWebContents(contents)) |
| 20 contents->SetUserData(UserDataKey(), new TabDialogsViews(contents)); | 20 contents->SetUserData(UserDataKey(), new TabDialogsViews(contents)); |
| 21 } | 21 } |
| 22 | 22 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 43 | 43 |
| 44 void TabDialogsViews::HideHungRendererDialog() { | 44 void TabDialogsViews::HideHungRendererDialog() { |
| 45 HungRendererDialogView::Hide(web_contents_); | 45 HungRendererDialogView::Hide(web_contents_); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void TabDialogsViews::ShowProfileSigninConfirmation( | 48 void TabDialogsViews::ShowProfileSigninConfirmation( |
| 49 Browser* browser, | 49 Browser* browser, |
| 50 Profile* profile, | 50 Profile* profile, |
| 51 const std::string& username, | 51 const std::string& username, |
| 52 ui::ProfileSigninConfirmationDelegate* delegate) { | 52 ui::ProfileSigninConfirmationDelegate* delegate) { |
| 53 #if !defined(OS_CHROMEOS) | |
| 53 ProfileSigninConfirmationDialogViews::ShowDialog( | 54 ProfileSigninConfirmationDialogViews::ShowDialog( |
| 54 browser, profile, username, delegate); | 55 browser, profile, username, delegate); |
| 56 #else | |
| 57 NOTREACHED(); | |
| 58 #endif | |
| 55 } | 59 } |
| 56 | 60 |
| 57 void TabDialogsViews::ShowManagePasswordsBubble(bool user_action) { | 61 void TabDialogsViews::ShowManagePasswordsBubble(bool user_action) { |
| 58 if (ManagePasswordsBubbleView::manage_password_bubble()) { | 62 if (ManagePasswordsBubbleView::manage_password_bubble()) { |
| 59 // The bubble is currently shown for some other tab. We should close it now | 63 // The bubble is currently shown for some other tab. We should close it now |
| 60 // and open for |web_contents_|. | 64 // and open for |web_contents_|. |
| 61 ManagePasswordsBubbleView::CloseCurrentBubble(); | 65 ManagePasswordsBubbleView::CloseCurrentBubble(); |
| 62 } | 66 } |
| 63 ManagePasswordsBubbleView::ShowBubble( | 67 ManagePasswordsBubbleView::ShowBubble( |
| 64 web_contents_, user_action ? ManagePasswordsBubbleView::USER_GESTURE | 68 web_contents_, user_action ? ManagePasswordsBubbleView::USER_GESTURE |
| 65 : ManagePasswordsBubbleView::AUTOMATIC); | 69 : ManagePasswordsBubbleView::AUTOMATIC); |
| 66 } | 70 } |
| 67 | 71 |
| 68 void TabDialogsViews::HideManagePasswordsBubble() { | 72 void TabDialogsViews::HideManagePasswordsBubble() { |
| 69 if (!ManagePasswordsBubbleView::manage_password_bubble()) | 73 if (!ManagePasswordsBubbleView::manage_password_bubble()) |
| 70 return; | 74 return; |
| 71 content::WebContents* bubble_web_contents = | 75 content::WebContents* bubble_web_contents = |
| 72 ManagePasswordsBubbleView::manage_password_bubble()->web_contents(); | 76 ManagePasswordsBubbleView::manage_password_bubble()->web_contents(); |
| 73 if (web_contents_ == bubble_web_contents) | 77 if (web_contents_ == bubble_web_contents) |
| 74 ManagePasswordsBubbleView::CloseCurrentBubble(); | 78 ManagePasswordsBubbleView::CloseCurrentBubble(); |
| 75 } | 79 } |
| 76 | 80 |
| 77 base::WeakPtr<ValidationMessageBubble> TabDialogsViews::ShowValidationMessage( | 81 base::WeakPtr<ValidationMessageBubble> TabDialogsViews::ShowValidationMessage( |
| 78 const gfx::Rect& anchor_in_root_view, | 82 const gfx::Rect& anchor_in_root_view, |
| 79 const base::string16& main_text, | 83 const base::string16& main_text, |
| 80 const base::string16& sub_text) { | 84 const base::string16& sub_text) { |
| 81 return (new ValidationMessageBubbleView( | 85 return (new ValidationMessageBubbleView( |
| 82 web_contents_, anchor_in_root_view, main_text, sub_text))->AsWeakPtr(); | 86 web_contents_, anchor_in_root_view, main_text, sub_text))->AsWeakPtr(); |
| 83 } | 87 } |
| OLD | NEW |