Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1062)

Side by Side Diff: chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc

Issue 10214001: WebDialogs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_html_ui_delegate_impl.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_wrapper.h"
13 #include "chrome/browser/ui/webui/html_dialog_tab_contents_delegate.h" 13 #include "chrome/browser/ui/webui/web_dialog_web_contents_delegate.h"
14 #include "chrome/browser/ui/webui/html_dialog_ui.h" 14 #include "chrome/browser/ui/webui/web_dialog_ui.h"
15 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
16 16
17 using content::WebContents; 17 using content::WebContents;
18 18
19 ConstrainedHtmlUIDelegateImpl::ConstrainedHtmlUIDelegateImpl( 19 ConstrainedWebDialogDelegateBase::ConstrainedWebDialogDelegateBase(
20 Profile* profile, 20 Profile* profile,
21 HtmlDialogUIDelegate* delegate, 21 WebDialogDelegate* delegate,
22 HtmlDialogTabContentsDelegate* tab_delegate) 22 WebDialogWebContentsDelegate* tab_delegate)
23 : HtmlDialogTabContentsDelegate(profile), 23 : WebDialogWebContentsDelegate(profile),
24 html_delegate_(delegate), 24 web_dialog_delegate_(delegate),
25 window_(NULL), 25 window_(NULL),
26 closed_via_webui_(false), 26 closed_via_webui_(false),
27 release_tab_on_close_(false) { 27 release_tab_on_close_(false) {
28 CHECK(delegate); 28 CHECK(delegate);
29 WebContents* web_contents = 29 WebContents* web_contents =
30 WebContents::Create(profile, NULL, MSG_ROUTING_NONE, NULL, NULL); 30 WebContents::Create(profile, NULL, MSG_ROUTING_NONE, NULL, NULL);
31 tab_.reset(new TabContentsWrapper(web_contents)); 31 tab_.reset(new TabContentsWrapper(web_contents));
32 if (tab_delegate) { 32 if (tab_delegate) {
33 override_tab_delegate_.reset(tab_delegate); 33 override_tab_delegate_.reset(tab_delegate);
34 web_contents->SetDelegate(tab_delegate); 34 web_contents->SetDelegate(tab_delegate);
35 } else { 35 } else {
36 web_contents->SetDelegate(this); 36 web_contents->SetDelegate(this);
37 } 37 }
38 // Set |this| as a property so the ConstrainedHtmlUI can retrieve it. 38 // Set |this| as a property so the ConstrainedWebDialogUI can retrieve it.
39 ConstrainedHtmlUI::GetPropertyAccessor().SetProperty( 39 ConstrainedWebDialogUI::GetPropertyAccessor().SetProperty(
40 web_contents->GetPropertyBag(), this); 40 web_contents->GetPropertyBag(), this);
41 41
42 web_contents->GetController().LoadURL(delegate->GetDialogContentURL(), 42 web_contents->GetController().LoadURL(delegate->GetDialogContentURL(),
43 content::Referrer(), 43 content::Referrer(),
44 content::PAGE_TRANSITION_START_PAGE, 44 content::PAGE_TRANSITION_START_PAGE,
45 std::string()); 45 std::string());
46 } 46 }
47 47
48 ConstrainedHtmlUIDelegateImpl::~ConstrainedHtmlUIDelegateImpl() { 48 ConstrainedWebDialogDelegateBase::~ConstrainedWebDialogDelegateBase() {
49 if (release_tab_on_close_) 49 if (release_tab_on_close_)
50 ignore_result(tab_.release()); 50 ignore_result(tab_.release());
51 } 51 }
52 52
53 const HtmlDialogUIDelegate* 53 const WebDialogDelegate*
54 ConstrainedHtmlUIDelegateImpl::GetHtmlDialogUIDelegate() const { 54 ConstrainedWebDialogDelegateBase::GetWebDialogDelegate() const {
55 return html_delegate_; 55 return web_dialog_delegate_;
56 } 56 }
57 57
58 HtmlDialogUIDelegate* 58 WebDialogDelegate*
59 ConstrainedHtmlUIDelegateImpl::GetHtmlDialogUIDelegate() { 59 ConstrainedWebDialogDelegateBase::GetWebDialogDelegate() {
60 return html_delegate_; 60 return web_dialog_delegate_;
61 } 61 }
62 62
63 void ConstrainedHtmlUIDelegateImpl::OnDialogCloseFromWebUI() { 63 void ConstrainedWebDialogDelegateBase::OnDialogCloseFromWebUI() {
64 closed_via_webui_ = true; 64 closed_via_webui_ = true;
65 window_->CloseConstrainedWindow(); 65 window_->CloseConstrainedWindow();
66 } 66 }
67 67
68 void ConstrainedHtmlUIDelegateImpl::set_window(ConstrainedWindow* window) { 68 void ConstrainedWebDialogDelegateBase::set_window(ConstrainedWindow* window) {
69 window_ = window; 69 window_ = window;
70 } 70 }
71 71
72 void ConstrainedHtmlUIDelegateImpl::set_override_tab_delegate( 72 void ConstrainedWebDialogDelegateBase::set_override_tab_delegate(
73 HtmlDialogTabContentsDelegate* override_tab_delegate) { 73 WebDialogWebContentsDelegate* override_tab_delegate) {
74 override_tab_delegate_.reset(override_tab_delegate); 74 override_tab_delegate_.reset(override_tab_delegate);
75 } 75 }
76 76
77 bool ConstrainedHtmlUIDelegateImpl::closed_via_webui() const { 77 bool ConstrainedWebDialogDelegateBase::closed_via_webui() const {
78 return closed_via_webui_; 78 return closed_via_webui_;
79 } 79 }
80 80
81 void ConstrainedHtmlUIDelegateImpl::ReleaseTabContentsOnDialogClose() { 81 void ConstrainedWebDialogDelegateBase::ReleaseTabContentsOnDialogClose() {
82 release_tab_on_close_ = true; 82 release_tab_on_close_ = true;
83 } 83 }
84 84
85 ConstrainedWindow* ConstrainedHtmlUIDelegateImpl::window() { 85 ConstrainedWindow* ConstrainedWebDialogDelegateBase::window() {
86 return window_; 86 return window_;
87 } 87 }
88 88
89 TabContentsWrapper* ConstrainedHtmlUIDelegateImpl::tab() { 89 TabContentsWrapper* ConstrainedWebDialogDelegateBase::tab() {
90 return tab_.get(); 90 return tab_.get();
91 } 91 }
92 92
93 void ConstrainedHtmlUIDelegateImpl::HandleKeyboardEvent( 93 void ConstrainedWebDialogDelegateBase::HandleKeyboardEvent(
94 const NativeWebKeyboardEvent& event) { 94 const NativeWebKeyboardEvent& event) {
95 } 95 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h ('k') | chrome/browser/ui/webui/constrained_web_dialog_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698