| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/webui/constrained_web_dialog_delegate_base.h" | 5 #include "chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/property_bag.h" | 9 #include "base/property_bag.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/constrained_window.h" | 11 #include "chrome/browser/ui/constrained_window.h" |
| 12 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 12 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 13 #include "chrome/browser/ui/webui/web_dialog_web_contents_delegate.h" | 13 #include "chrome/browser/ui/webui/web_dialog_web_contents_delegate.h" |
| 14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 15 #include "ui/web_dialogs/web_dialog_delegate.h" | 15 #include "ui/web_dialogs/web_dialog_delegate.h" |
| 16 #include "ui/web_dialogs/web_dialog_ui.h" | 16 #include "ui/web_dialogs/web_dialog_ui.h" |
| 17 | 17 |
| 18 using content::NativeWebKeyboardEvent; | 18 using content::NativeWebKeyboardEvent; |
| 19 using content::WebContents; | 19 using content::WebContents; |
| 20 using ui::ConstrainedWebDialogUI; | 20 using ui::ConstrainedWebDialogUI; |
| 21 using ui::WebDialogDelegate; | 21 using ui::WebDialogDelegate; |
| 22 | 22 |
| 23 ConstrainedWebDialogDelegateBase::ConstrainedWebDialogDelegateBase( | 23 ConstrainedWebDialogDelegateBase::ConstrainedWebDialogDelegateBase( |
| 24 Profile* profile, | 24 Profile* profile, |
| 25 WebDialogDelegate* delegate, | 25 WebDialogDelegate* delegate, |
| 26 WebDialogWebContentsDelegate* tab_delegate) | 26 WebDialogWebContentsDelegate* tab_delegate) |
| 27 : WebDialogWebContentsDelegate(profile), | 27 : WebDialogWebContentsDelegate(profile), |
| 28 web_dialog_delegate_(delegate), | 28 web_dialog_delegate_(delegate), |
| 29 window_(NULL), | 29 window_(NULL), |
| 30 closed_via_webui_(false), | 30 closed_via_webui_(false), |
| 31 release_tab_on_close_(false) { | 31 release_tab_on_close_(false) { |
| 32 CHECK(delegate); | 32 CHECK(delegate); |
| 33 WebContents* web_contents = | 33 WebContents* web_contents = |
| 34 WebContents::Create(profile, NULL, MSG_ROUTING_NONE, NULL, NULL); | 34 WebContents::Create(profile, NULL, MSG_ROUTING_NONE, NULL, NULL); |
| 35 tab_.reset(new TabContentsWrapper(web_contents)); | 35 tab_.reset(new TabContents(web_contents)); |
| 36 if (tab_delegate) { | 36 if (tab_delegate) { |
| 37 override_tab_delegate_.reset(tab_delegate); | 37 override_tab_delegate_.reset(tab_delegate); |
| 38 web_contents->SetDelegate(tab_delegate); | 38 web_contents->SetDelegate(tab_delegate); |
| 39 } else { | 39 } else { |
| 40 web_contents->SetDelegate(this); | 40 web_contents->SetDelegate(this); |
| 41 } | 41 } |
| 42 // Set |this| as a property so the ConstrainedWebDialogUI can retrieve it. | 42 // Set |this| as a property so the ConstrainedWebDialogUI can retrieve it. |
| 43 ConstrainedWebDialogUI::GetPropertyAccessor().SetProperty( | 43 ConstrainedWebDialogUI::GetPropertyAccessor().SetProperty( |
| 44 web_contents->GetPropertyBag(), this); | 44 web_contents->GetPropertyBag(), this); |
| 45 | 45 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } | 83 } |
| 84 | 84 |
| 85 void ConstrainedWebDialogDelegateBase::ReleaseTabContentsOnDialogClose() { | 85 void ConstrainedWebDialogDelegateBase::ReleaseTabContentsOnDialogClose() { |
| 86 release_tab_on_close_ = true; | 86 release_tab_on_close_ = true; |
| 87 } | 87 } |
| 88 | 88 |
| 89 ConstrainedWindow* ConstrainedWebDialogDelegateBase::window() { | 89 ConstrainedWindow* ConstrainedWebDialogDelegateBase::window() { |
| 90 return window_; | 90 return window_; |
| 91 } | 91 } |
| 92 | 92 |
| 93 TabContentsWrapper* ConstrainedWebDialogDelegateBase::tab() { | 93 TabContents* ConstrainedWebDialogDelegateBase::tab() { |
| 94 return tab_.get(); | 94 return tab_.get(); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void ConstrainedWebDialogDelegateBase::HandleKeyboardEvent( | 97 void ConstrainedWebDialogDelegateBase::HandleKeyboardEvent( |
| 98 const NativeWebKeyboardEvent& event) { | 98 const NativeWebKeyboardEvent& event) { |
| 99 } | 99 } |
| OLD | NEW |