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

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

Issue 12276010: Factor out uses of the WebContentsModalDialog interface from platform-independent code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove incorrect override Created 7 years, 10 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_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 "chrome/browser/ui/web_contents_modal_dialog.h" 9 #include "chrome/browser/ui/web_contents_modal_dialog.h"
10 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" 10 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h"
11 #include "content/public/browser/web_contents.h" 11 #include "content/public/browser/web_contents.h"
12 #include "ipc/ipc_message.h" 12 #include "ipc/ipc_message.h"
13 #include "ui/web_dialogs/web_dialog_delegate.h" 13 #include "ui/web_dialogs/web_dialog_delegate.h"
14 #include "ui/web_dialogs/web_dialog_ui.h" 14 #include "ui/web_dialogs/web_dialog_ui.h"
15 15
16 using content::NativeWebKeyboardEvent; 16 using content::NativeWebKeyboardEvent;
17 using content::WebContents; 17 using content::WebContents;
18 using ui::WebDialogDelegate; 18 using ui::WebDialogDelegate;
19 using ui::WebDialogWebContentsDelegate; 19 using ui::WebDialogWebContentsDelegate;
20 20
21 ConstrainedWebDialogDelegateBase::ConstrainedWebDialogDelegateBase( 21 ConstrainedWebDialogDelegateBase::ConstrainedWebDialogDelegateBase(
22 content::BrowserContext* browser_context, 22 content::BrowserContext* browser_context,
23 WebDialogDelegate* delegate, 23 WebDialogDelegate* delegate,
24 WebDialogWebContentsDelegate* tab_delegate) 24 WebDialogWebContentsDelegate* tab_delegate)
25 : WebDialogWebContentsDelegate(browser_context, 25 : WebDialogWebContentsDelegate(browser_context,
26 new ChromeWebContentsHandler), 26 new ChromeWebContentsHandler),
27 web_dialog_delegate_(delegate), 27 web_dialog_delegate_(delegate),
28 window_(NULL),
29 closed_via_webui_(false), 28 closed_via_webui_(false),
30 release_contents_on_close_(false) { 29 release_contents_on_close_(false) {
31 CHECK(delegate); 30 CHECK(delegate);
32 web_contents_.reset( 31 web_contents_.reset(
33 WebContents::Create(WebContents::CreateParams(browser_context))); 32 WebContents::Create(WebContents::CreateParams(browser_context)));
34 if (tab_delegate) { 33 if (tab_delegate) {
35 override_tab_delegate_.reset(tab_delegate); 34 override_tab_delegate_.reset(tab_delegate);
36 web_contents_->SetDelegate(tab_delegate); 35 web_contents_->SetDelegate(tab_delegate);
37 } else { 36 } else {
38 web_contents_->SetDelegate(this); 37 web_contents_->SetDelegate(this);
(...skipping 17 matching lines...) Expand all
56 return web_dialog_delegate_.get(); 55 return web_dialog_delegate_.get();
57 } 56 }
58 57
59 WebDialogDelegate* 58 WebDialogDelegate*
60 ConstrainedWebDialogDelegateBase::GetWebDialogDelegate() { 59 ConstrainedWebDialogDelegateBase::GetWebDialogDelegate() {
61 return web_dialog_delegate_.get(); 60 return web_dialog_delegate_.get();
62 } 61 }
63 62
64 void ConstrainedWebDialogDelegateBase::OnDialogCloseFromWebUI() { 63 void ConstrainedWebDialogDelegateBase::OnDialogCloseFromWebUI() {
65 closed_via_webui_ = true; 64 closed_via_webui_ = true;
66 window_->CloseWebContentsModalDialog(); 65 CloseContents(web_contents_.get());
67 }
68
69 void ConstrainedWebDialogDelegateBase::set_window(
70 WebContentsModalDialog* window) {
71 window_ = window;
72 } 66 }
73 67
74 bool ConstrainedWebDialogDelegateBase::closed_via_webui() const { 68 bool ConstrainedWebDialogDelegateBase::closed_via_webui() const {
75 return closed_via_webui_; 69 return closed_via_webui_;
76 } 70 }
77 71
78 void ConstrainedWebDialogDelegateBase::ReleaseWebContentsOnDialogClose() { 72 void ConstrainedWebDialogDelegateBase::ReleaseWebContentsOnDialogClose() {
79 release_contents_on_close_ = true; 73 release_contents_on_close_ = true;
80 } 74 }
81 75
82 WebContentsModalDialog* ConstrainedWebDialogDelegateBase::GetWindow() { 76 NativeWebContentsModalDialog
83 return window_; 77 ConstrainedWebDialogDelegateBase::GetNativeDialog() {
78 NOTREACHED();
79 return NULL;
84 } 80 }
85 81
86 WebContents* ConstrainedWebDialogDelegateBase::GetWebContents() { 82 WebContents* ConstrainedWebDialogDelegateBase::GetWebContents() {
87 return web_contents_.get(); 83 return web_contents_.get();
88 } 84 }
89 85
90 void ConstrainedWebDialogDelegateBase::HandleKeyboardEvent( 86 void ConstrainedWebDialogDelegateBase::HandleKeyboardEvent(
91 content::WebContents* source, 87 content::WebContents* source,
92 const NativeWebKeyboardEvent& event) { 88 const NativeWebKeyboardEvent& event) {
93 } 89 }
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