ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / chrome / browser / chromeos / login / ui / simple_web_view_dialog.h
blob1bb69a9d0bb5537e6d1058bdea3f2c7f41fa0415
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_UI_SIMPLE_WEB_VIEW_DIALOG_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_UI_SIMPLE_WEB_VIEW_DIALOG_H_
8 #include <string>
9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/command_updater_delegate.h"
11 #include "chrome/browser/ui/toolbar/toolbar_model_delegate.h"
12 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
13 #include "content/public/browser/page_navigator.h"
14 #include "content/public/browser/web_contents_delegate.h"
15 #include "ui/views/controls/button/image_button.h"
16 #include "ui/views/widget/widget_delegate.h"
17 #include "url/gurl.h"
19 class CommandUpdater;
20 class Profile;
21 class ReloadButton;
22 class ToolbarModel;
24 namespace views {
25 class WebView;
26 class Widget;
29 namespace chromeos {
31 class StubBubbleModelDelegate;
33 // View class which shows the light version of the toolbar and the web contents.
34 // 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
36 // to be used for sign in to captive portal on login screen (when Browser
37 // isn't running).
38 class SimpleWebViewDialog : public views::ButtonListener,
39 public views::WidgetDelegateView,
40 public LocationBarView::Delegate,
41 public ToolbarModelDelegate,
42 public CommandUpdaterDelegate,
43 public content::PageNavigator,
44 public content::WebContentsDelegate {
45 public:
46 explicit SimpleWebViewDialog(Profile* profile);
47 ~SimpleWebViewDialog() override;
49 // Starts loading.
50 void StartLoad(const GURL& gurl);
52 // Inits view. Should be attached to a Widget before call.
53 void Init();
55 // Overridden from views::View:
56 void Layout() override;
58 // Overridden from views::WidgetDelegate:
59 views::View* GetContentsView() override;
60 views::View* GetInitiallyFocusedView() override;
62 // Implements views::ButtonListener:
63 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
65 // Implements content::PageNavigator:
66 content::WebContents* OpenURL(const content::OpenURLParams& params) override;
68 // Implements content::WebContentsDelegate:
69 void NavigationStateChanged(content::WebContents* source,
70 content::InvalidateTypes changed_flags) override;
71 void LoadingStateChanged(content::WebContents* source,
72 bool to_different_document) override;
74 // Implements LocationBarView::Delegate:
75 content::WebContents* GetWebContents() override;
76 ToolbarModel* GetToolbarModel() override;
77 const ToolbarModel* GetToolbarModel() const override;
78 InstantController* GetInstant() override;
79 views::Widget* CreateViewsBubble(
80 views::BubbleDelegateView* bubble_delegate) override;
81 PageActionImageView* CreatePageActionImageView(
82 LocationBarView* owner,
83 ExtensionAction* action) override;
84 ContentSettingBubbleModelDelegate* GetContentSettingBubbleModelDelegate()
85 override;
86 void ShowWebsiteSettings(content::WebContents* web_contents,
87 const GURL& url,
88 const content::SSLStatus& ssl) override;
90 // Implements ToolbarModelDelegate:
91 content::WebContents* GetActiveWebContents() const override;
93 // Implements CommandUpdaterDelegate:
94 void ExecuteCommandWithDisposition(int id, WindowOpenDisposition) override;
96 private:
97 friend class SimpleWebViewDialogTest;
99 void LoadImages();
100 void UpdateButtons();
101 void UpdateReload(bool is_loading, bool force);
103 Profile* profile_;
104 scoped_ptr<ToolbarModel> toolbar_model_;
105 scoped_ptr<CommandUpdater> command_updater_;
107 // Controls
108 views::ImageButton* back_;
109 views::ImageButton* forward_;
110 ReloadButton* reload_;
111 LocationBarView* location_bar_;
112 views::WebView* web_view_;
114 // Contains |web_view_| while it isn't owned by the view.
115 scoped_ptr<views::WebView> web_view_container_;
117 scoped_ptr<StubBubbleModelDelegate> bubble_model_delegate_;
119 DISALLOW_COPY_AND_ASSIGN(SimpleWebViewDialog);
122 } // namespace chromeos
124 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_UI_SIMPLE_WEB_VIEW_DIALOG_H_