| 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/cocoa/tab_dialogs_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/tab_dialogs_cocoa.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #import "chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h" | 8 #import "chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h" |
| 9 #import "chrome/browser/ui/cocoa/hung_renderer_controller.h" | 9 #import "chrome/browser/ui/cocoa/hung_renderer_controller.h" |
| 10 #import "chrome/browser/ui/cocoa/passwords/passwords_bubble_cocoa.h" | 10 #import "chrome/browser/ui/cocoa/passwords/passwords_bubble_cocoa.h" |
| 11 #import "chrome/browser/ui/cocoa/profiles/profile_signin_confirmation_dialog_coc
oa.h" | 11 #import "chrome/browser/ui/cocoa/profiles/profile_signin_confirmation_dialog_coc
oa.h" |
| 12 #import "chrome/browser/ui/cocoa/validation_message_bubble_cocoa.h" | 12 #import "chrome/browser/ui/cocoa/validation_message_bubble_cocoa.h" |
| 13 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
| 14 #include "ui/base/material_design/material_design_controller.h" |
| 14 | 15 |
| 15 // static | 16 // static |
| 16 void TabDialogs::CreateForWebContents(content::WebContents* contents) { | 17 void TabDialogs::CreateForWebContents(content::WebContents* contents) { |
| 17 DCHECK(contents); | 18 DCHECK(contents); |
| 18 if (!FromWebContents(contents)) | 19 if (!FromWebContents(contents)) { |
| 19 contents->SetUserData(UserDataKey(), new TabDialogsCocoa(contents)); | 20 TabDialogs* tab_dialogs = |
| 21 ui::MaterialDesignController::IsSecondaryUiMaterial() ? |
| 22 TabDialogsCocoa::CreateTabDialogsViewsMac(contents) : |
| 23 tab_dialogs = new TabDialogsCocoa(contents); |
| 24 contents->SetUserData(UserDataKey(), tab_dialogs); |
| 25 } |
| 20 } | 26 } |
| 21 | 27 |
| 22 TabDialogsCocoa::TabDialogsCocoa(content::WebContents* contents) | 28 TabDialogsCocoa::TabDialogsCocoa(content::WebContents* contents) |
| 23 : web_contents_(contents) { | 29 : web_contents_(contents) { |
| 24 DCHECK(contents); | 30 DCHECK(contents); |
| 25 } | 31 } |
| 26 | 32 |
| 27 TabDialogsCocoa::~TabDialogsCocoa() { | 33 TabDialogsCocoa::~TabDialogsCocoa() { |
| 28 } | 34 } |
| 29 | 35 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // The bubble is closed when it loses the focus. | 75 // The bubble is closed when it loses the focus. |
| 70 } | 76 } |
| 71 | 77 |
| 72 base::WeakPtr<ValidationMessageBubble> TabDialogsCocoa::ShowValidationMessage( | 78 base::WeakPtr<ValidationMessageBubble> TabDialogsCocoa::ShowValidationMessage( |
| 73 const gfx::Rect& anchor_in_root_view, | 79 const gfx::Rect& anchor_in_root_view, |
| 74 const base::string16& main_text, | 80 const base::string16& main_text, |
| 75 const base::string16& sub_text) { | 81 const base::string16& sub_text) { |
| 76 return (new ValidationMessageBubbleCocoa( | 82 return (new ValidationMessageBubbleCocoa( |
| 77 web_contents_, anchor_in_root_view, main_text, sub_text))->AsWeakPtr(); | 83 web_contents_, anchor_in_root_view, main_text, sub_text))->AsWeakPtr(); |
| 78 } | 84 } |
| OLD | NEW |