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

Side by Side Diff: chrome/browser/ui/views/web_dialog_view.h

Issue 10353007: Extract a minimal subset of WebDialogUI/WebDialogDelegate from src/chrome -> src/ui/web_dialogs Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 7 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 #ifndef CHROME_BROWSER_UI_VIEWS_WEB_DIALOG_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_WEB_DIALOG_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_WEB_DIALOG_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_WEB_DIALOG_VIEW_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "chrome/browser/tab_render_watcher.h" 14 #include "chrome/browser/tab_render_watcher.h"
15 #include "chrome/browser/ui/webui/web_dialog_delegate.h" 15 #include "chrome/browser/ui/webui/chrome_web_dialog_web_contents_delegate.h"
16 #include "chrome/browser/ui/webui/web_dialog_web_contents_delegate.h" 16 #include "ui/web_dialogs/web_dialog_delegate.h"
17 #include "ui/web_dialogs/web_dialog_ui.h"
17 #include "ui/gfx/size.h" 18 #include "ui/gfx/size.h"
18 #include "ui/views/view.h" 19 #include "ui/views/view.h"
19 #include "ui/views/widget/widget_delegate.h" 20 #include "ui/views/widget/widget_delegate.h"
20 21
21 class Browser; 22 class Browser;
22 class WebDialogController; 23 class WebDialogController;
23 class Profile; 24 class Profile;
24 25
25 namespace views { 26 namespace views {
26 class WebView; 27 class WebView;
27 } 28 }
28 29
29 //////////////////////////////////////////////////////////////////////////////// 30 ////////////////////////////////////////////////////////////////////////////////
30 // 31 //
31 // WebDialogView is a view used to display an web dialog to the user. The 32 // WebDialogView is a view used to display an web dialog to the user. The
32 // content of the dialogs is determined by the delegate 33 // content of the dialogs is determined by the delegate
33 // (WebDialogDelegate), but is basically a file URL along with a 34 // (WebDialogDelegate), but is basically a file URL along with a
34 // JSON input string. The HTML is supposed to show a UI to the user and is 35 // JSON input string. The HTML is supposed to show a UI to the user and is
35 // expected to send back a JSON file as a return value. 36 // expected to send back a JSON file as a return value.
36 // 37 //
37 //////////////////////////////////////////////////////////////////////////////// 38 ////////////////////////////////////////////////////////////////////////////////
38 // 39 //
39 // TODO(akalin): Make WebDialogView contain an WebDialogWebContentsDelegate 40 // TODO(akalin): Make WebDialogView contain an WebDialogWebContentsDelegate
40 // instead of inheriting from it to avoid violating the "no multiple 41 // instead of inheriting from it to avoid violating the "no multiple
41 // inheritance" rule. 42 // inheritance" rule.
42 // TODO(beng): This class should not depend on Browser or Profile, only 43 // TODO(beng): This class should not depend on Browser or Profile, only
43 // content::BrowserContext. 44 // content::BrowserContext.
44 class WebDialogView 45 class WebDialogView
45 : public views::View, 46 : public views::View,
46 public WebDialogWebContentsDelegate, 47 public ChromeWebDialogWebContentsDelegate,
47 public WebDialogDelegate, 48 public web_dialogs::WebDialogDelegate,
48 public views::WidgetDelegate, 49 public views::WidgetDelegate,
49 public TabRenderWatcher::Delegate { 50 public TabRenderWatcher::Delegate {
50 public: 51 public:
51 WebDialogView(Profile* profile, 52 WebDialogView(Profile* profile,
52 Browser* browser, 53 Browser* browser,
53 WebDialogDelegate* delegate); 54 web_dialogs::WebDialogDelegate* delegate);
54 virtual ~WebDialogView(); 55 virtual ~WebDialogView();
55 56
56 // For testing. 57 // For testing.
57 content::WebContents* web_contents(); 58 content::WebContents* web_contents();
58 59
59 // Overridden from views::View: 60 // Overridden from views::View:
60 virtual gfx::Size GetPreferredSize() OVERRIDE; 61 virtual gfx::Size GetPreferredSize() OVERRIDE;
61 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) 62 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator)
62 OVERRIDE; 63 OVERRIDE;
63 virtual void ViewHierarchyChanged(bool is_add, 64 virtual void ViewHierarchyChanged(bool is_add,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // until the property is removed. 126 // until the property is removed.
126 bool initialized_; 127 bool initialized_;
127 128
128 // Watches for WebContents rendering. 129 // Watches for WebContents rendering.
129 scoped_ptr<TabRenderWatcher> tab_watcher_; 130 scoped_ptr<TabRenderWatcher> tab_watcher_;
130 131
131 // This view is a delegate to the HTML content since it needs to get notified 132 // This view is a delegate to the HTML content since it needs to get notified
132 // about when the dialog is closing. For all other actions (besides dialog 133 // about when the dialog is closing. For all other actions (besides dialog
133 // closing) we delegate to the creator of this view, which we keep track of 134 // closing) we delegate to the creator of this view, which we keep track of
134 // using this variable. 135 // using this variable.
135 WebDialogDelegate* delegate_; 136 web_dialogs::WebDialogDelegate* delegate_;
136 137
137 // Controls lifetime of dialog. 138 // Controls lifetime of dialog.
138 scoped_ptr<WebDialogController> dialog_controller_; 139 scoped_ptr<WebDialogController> dialog_controller_;
139 140
140 views::WebView* web_view_; 141 views::WebView* web_view_;
141 142
142 DISALLOW_COPY_AND_ASSIGN(WebDialogView); 143 DISALLOW_COPY_AND_ASSIGN(WebDialogView);
143 }; 144 };
144 145
145 #endif // CHROME_BROWSER_UI_VIEWS_WEB_DIALOG_VIEW_H_ 146 #endif // CHROME_BROWSER_UI_VIEWS_WEB_DIALOG_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698