| 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 #import "chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h" | 7 #import "chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h" |
| 8 #import "chrome/browser/ui/cocoa/hung_renderer_controller.h" | 8 #import "chrome/browser/ui/cocoa/hung_renderer_controller.h" |
| 9 #import "chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_cocoa.h" | 9 #import "chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_cocoa.h" |
| 10 #import "chrome/browser/ui/cocoa/profiles/profile_signin_confirmation_dialog_coc
oa.h" | 10 #import "chrome/browser/ui/cocoa/profiles/profile_signin_confirmation_dialog_coc
oa.h" |
| 11 #import "chrome/browser/ui/cocoa/validation_message_bubble_cocoa.h" | 11 #import "chrome/browser/ui/cocoa/validation_message_bubble_cocoa.h" |
| 12 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
| 13 | 13 |
| 14 // static | 14 // static |
| 15 void TabDialogs::CreateForWebContents(content::WebContents* contents) { | 15 void TabDialogs::CreateForWebContents(content::WebContents* contents) { |
| 16 DCHECK(contents); | 16 DCHECK(contents); |
| 17 if (!FromWebContents(contents)) | 17 if (!FromWebContents(contents)) |
| 18 contents->SetUserData(UserDataKey(), new TabDialogsCocoa(contents)); | 18 contents->SetUserData(UserDataKey(), new TabDialogsCocoa(contents)); |
| 19 } | 19 } |
| 20 | 20 |
| 21 TabDialogsCocoa::TabDialogsCocoa(content::WebContents* contents) | 21 TabDialogsCocoa::TabDialogsCocoa(content::WebContents* contents) |
| 22 : web_contents_(contents) { | 22 : web_contents_(contents) { |
| 23 DCHECK(contents); | 23 DCHECK(contents); |
| 24 } | 24 } |
| 25 | 25 |
| 26 TabDialogsCocoa::~TabDialogsCocoa() { | 26 TabDialogsCocoa::~TabDialogsCocoa() { |
| 27 } | 27 } |
| 28 | 28 |
| 29 gfx::NativeView TabDialogsCocoa::GetDialogParentView() const { |
| 30 // View hierarchy of the contents view: |
| 31 // NSView -- switchView, same for all tabs |
| 32 // +- TabContentsContainerView -- TabContentsController's view |
| 33 // +- WebContentsViewCocoa |
| 34 // |
| 35 // Changing it? Do not forget to modify |
| 36 // -[TabStripController swapInTabAtIndex:] too. |
| 37 return [web_contents_->GetNativeView() superview]; |
| 38 } |
| 39 |
| 29 void TabDialogsCocoa::ShowCollectedCookies() { | 40 void TabDialogsCocoa::ShowCollectedCookies() { |
| 30 // Deletes itself on close. | 41 // Deletes itself on close. |
| 31 new CollectedCookiesMac(web_contents_); | 42 new CollectedCookiesMac(web_contents_); |
| 32 } | 43 } |
| 33 | 44 |
| 34 void TabDialogsCocoa::ShowHungRendererDialog() { | 45 void TabDialogsCocoa::ShowHungRendererDialog() { |
| 35 [HungRendererController showForWebContents:web_contents_]; | 46 [HungRendererController showForWebContents:web_contents_]; |
| 36 } | 47 } |
| 37 | 48 |
| 38 void TabDialogsCocoa::HideHungRendererDialog() { | 49 void TabDialogsCocoa::HideHungRendererDialog() { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 56 // The bubble is closed when it loses the focus. | 67 // The bubble is closed when it loses the focus. |
| 57 } | 68 } |
| 58 | 69 |
| 59 scoped_ptr<ValidationMessageBubble> TabDialogsCocoa::ShowValidationMessage( | 70 scoped_ptr<ValidationMessageBubble> TabDialogsCocoa::ShowValidationMessage( |
| 60 const gfx::Rect& anchor_in_root_view, | 71 const gfx::Rect& anchor_in_root_view, |
| 61 const base::string16& main_text, | 72 const base::string16& main_text, |
| 62 const base::string16& sub_text) { | 73 const base::string16& sub_text) { |
| 63 return make_scoped_ptr(new ValidationMessageBubbleCocoa( | 74 return make_scoped_ptr(new ValidationMessageBubbleCocoa( |
| 64 web_contents_, anchor_in_root_view, main_text, sub_text)); | 75 web_contents_, anchor_in_root_view, main_text, sub_text)); |
| 65 } | 76 } |
| OLD | NEW |