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

Side by Side Diff: chrome/browser/chromeos/login/simple_web_view_dialog.h

Issue 15879007: Support web contents modal dialogs within SimpleWebViewDialog and WebUILoginView (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comment Created 7 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/simple_web_view_dialog.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_CHROMEOS_LOGIN_SIMPLE_WEB_VIEW_DIALOG_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SIMPLE_WEB_VIEW_DIALOG_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIMPLE_WEB_VIEW_DIALOG_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIMPLE_WEB_VIEW_DIALOG_H_
7 7
8 #include <string> 8 #include <string>
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/observer_list.h"
10 #include "chrome/browser/command_updater_delegate.h" 11 #include "chrome/browser/command_updater_delegate.h"
12 #include "chrome/browser/ui/chrome_web_modal_dialog_manager_delegate.h"
11 #include "chrome/browser/ui/toolbar/toolbar_model_delegate.h" 13 #include "chrome/browser/ui/toolbar/toolbar_model_delegate.h"
12 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 14 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
15 #include "components/web_modal/web_contents_modal_dialog_host.h"
13 #include "content/public/browser/page_navigator.h" 16 #include "content/public/browser/page_navigator.h"
14 #include "content/public/browser/web_contents_delegate.h" 17 #include "content/public/browser/web_contents_delegate.h"
15 #include "googleurl/src/gurl.h" 18 #include "googleurl/src/gurl.h"
16 #include "ui/views/controls/button/image_button.h" 19 #include "ui/views/controls/button/image_button.h"
17 #include "ui/views/widget/widget_delegate.h" 20 #include "ui/views/widget/widget_delegate.h"
18 21
19 class CommandUpdater; 22 class CommandUpdater;
20 class Profile; 23 class Profile;
21 class ReloadButton; 24 class ReloadButton;
22 class ToolbarModel; 25 class ToolbarModel;
(...skipping 11 matching lines...) Expand all
34 // Light version of the toolbar includes back, forward buttons and location 37 // Light version of the toolbar includes back, forward buttons and location
35 // bar. Location bar is shown in read only mode, because this view is designed 38 // bar. Location bar is shown in read only mode, because this view is designed
36 // to be used for sign in to captive portal on login screen (when Browser 39 // to be used for sign in to captive portal on login screen (when Browser
37 // isn't running). 40 // isn't running).
38 class SimpleWebViewDialog : public views::ButtonListener, 41 class SimpleWebViewDialog : public views::ButtonListener,
39 public views::WidgetDelegateView, 42 public views::WidgetDelegateView,
40 public LocationBarView::Delegate, 43 public LocationBarView::Delegate,
41 public ToolbarModelDelegate, 44 public ToolbarModelDelegate,
42 public CommandUpdaterDelegate, 45 public CommandUpdaterDelegate,
43 public content::PageNavigator, 46 public content::PageNavigator,
44 public content::WebContentsDelegate { 47 public content::WebContentsDelegate,
48 public ChromeWebModalDialogManagerDelegate,
49 public web_modal::WebContentsModalDialogHost {
45 public: 50 public:
46 explicit SimpleWebViewDialog(Profile* profile); 51 explicit SimpleWebViewDialog(Profile* profile);
47 virtual ~SimpleWebViewDialog(); 52 virtual ~SimpleWebViewDialog();
48 53
49 // Starts loading. 54 // Starts loading.
50 void StartLoad(const GURL& gurl); 55 void StartLoad(const GURL& gurl);
51 56
52 // Inits view. Should be attached to a Widget before call. 57 // Inits view. Should be attached to a Widget before call.
53 void Init(); 58 void Init();
54 59
60 // Overridden from views::View:
61 virtual void Layout() OVERRIDE;
62
55 // Overridden from views::WidgetDelegate: 63 // Overridden from views::WidgetDelegate:
56 virtual views::View* GetContentsView() OVERRIDE; 64 virtual views::View* GetContentsView() OVERRIDE;
57 virtual views::View* GetInitiallyFocusedView() OVERRIDE; 65 virtual views::View* GetInitiallyFocusedView() OVERRIDE;
58 66
59 // Implements views::ButtonListener: 67 // Implements views::ButtonListener:
60 virtual void ButtonPressed(views::Button* sender, 68 virtual void ButtonPressed(views::Button* sender,
61 const ui::Event& event) OVERRIDE; 69 const ui::Event& event) OVERRIDE;
62 70
63 // Implements content::PageNavigator: 71 // Implements content::PageNavigator:
64 virtual content::WebContents* OpenURL( 72 virtual content::WebContents* OpenURL(
(...skipping 21 matching lines...) Expand all
86 virtual void OnInputInProgress(bool in_progress) OVERRIDE; 94 virtual void OnInputInProgress(bool in_progress) OVERRIDE;
87 95
88 // Implements ToolbarModelDelegate: 96 // Implements ToolbarModelDelegate:
89 virtual content::WebContents* GetActiveWebContents() const OVERRIDE; 97 virtual content::WebContents* GetActiveWebContents() const OVERRIDE;
90 98
91 // Implements CommandUpdaterDelegate: 99 // Implements CommandUpdaterDelegate:
92 virtual void ExecuteCommandWithDisposition( 100 virtual void ExecuteCommandWithDisposition(
93 int id, 101 int id,
94 WindowOpenDisposition) OVERRIDE; 102 WindowOpenDisposition) OVERRIDE;
95 103
104 // Implements ChromeWebModalDialogManagerDelegate:
105 virtual web_modal::WebContentsModalDialogHost*
106 GetWebContentsModalDialogHost() OVERRIDE;
107
108 // Implements web_modal::WebContentsModalDialogHost:
109 virtual gfx::NativeView GetHostView() const OVERRIDE;
110 virtual gfx::Point GetDialogPosition(const gfx::Size& size) OVERRIDE;
111 virtual void AddObserver(
112 web_modal::WebContentsModalDialogHostObserver* observer) OVERRIDE;
113 virtual void RemoveObserver(
114 web_modal::WebContentsModalDialogHostObserver* observer) OVERRIDE;
115
96 private: 116 private:
97 void LoadImages(); 117 void LoadImages();
98 void UpdateButtons(); 118 void UpdateButtons();
99 void UpdateReload(bool is_loading, bool force); 119 void UpdateReload(bool is_loading, bool force);
100 120
101 Profile* profile_; 121 Profile* profile_;
102 scoped_ptr<ToolbarModel> toolbar_model_; 122 scoped_ptr<ToolbarModel> toolbar_model_;
103 scoped_ptr<CommandUpdater> command_updater_; 123 scoped_ptr<CommandUpdater> command_updater_;
104 124
105 // Controls 125 // Controls
106 views::ImageButton* back_; 126 views::ImageButton* back_;
107 views::ImageButton* forward_; 127 views::ImageButton* forward_;
108 ReloadButton* reload_; 128 ReloadButton* reload_;
109 LocationBarView* location_bar_; 129 LocationBarView* location_bar_;
110 views::WebView* web_view_; 130 views::WebView* web_view_;
111 131
112 // Contains |web_view_| while it isn't owned by the view. 132 // Contains |web_view_| while it isn't owned by the view.
113 scoped_ptr<views::WebView> web_view_container_; 133 scoped_ptr<views::WebView> web_view_container_;
114 134
115 scoped_ptr<StubBubbleModelDelegate> bubble_model_delegate_; 135 scoped_ptr<StubBubbleModelDelegate> bubble_model_delegate_;
116 136
137 ObserverList<web_modal::WebContentsModalDialogHostObserver> observer_list_;
138
117 DISALLOW_COPY_AND_ASSIGN(SimpleWebViewDialog); 139 DISALLOW_COPY_AND_ASSIGN(SimpleWebViewDialog);
118 }; 140 };
119 141
120 } // chromeos 142 } // chromeos
121 143
122 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIMPLE_WEB_VIEW_DIALOG_H_ 144 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIMPLE_WEB_VIEW_DIALOG_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/simple_web_view_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698