| OLD | NEW |
| 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 UI_VIEWS_CONTROLS_WEBVIEW_WEB_DIALOG_VIEW_H_ | 5 #ifndef UI_VIEWS_CONTROLS_WEBVIEW_WEB_DIALOG_VIEW_H_ |
| 6 #define UI_VIEWS_CONTROLS_WEBVIEW_WEB_DIALOG_VIEW_H_ | 6 #define UI_VIEWS_CONTROLS_WEBVIEW_WEB_DIALOG_VIEW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // inheritance" rule. | 39 // inheritance" rule. |
| 40 class WEBVIEW_EXPORT WebDialogView : public views::ClientView, | 40 class WEBVIEW_EXPORT WebDialogView : public views::ClientView, |
| 41 public ui::WebDialogWebContentsDelegate, | 41 public ui::WebDialogWebContentsDelegate, |
| 42 public ui::WebDialogDelegate, | 42 public ui::WebDialogDelegate, |
| 43 public views::WidgetDelegate { | 43 public views::WidgetDelegate { |
| 44 public: | 44 public: |
| 45 // |handler| must not be NULL and this class takes the ownership. | 45 // |handler| must not be NULL and this class takes the ownership. |
| 46 WebDialogView(content::BrowserContext* context, | 46 WebDialogView(content::BrowserContext* context, |
| 47 ui::WebDialogDelegate* delegate, | 47 ui::WebDialogDelegate* delegate, |
| 48 WebContentsHandler* handler); | 48 WebContentsHandler* handler); |
| 49 virtual ~WebDialogView(); | 49 ~WebDialogView() override; |
| 50 | 50 |
| 51 // For testing. | 51 // For testing. |
| 52 content::WebContents* web_contents(); | 52 content::WebContents* web_contents(); |
| 53 | 53 |
| 54 // Overridden from views::ClientView: | 54 // Overridden from views::ClientView: |
| 55 virtual gfx::Size GetPreferredSize() const override; | 55 gfx::Size GetPreferredSize() const override; |
| 56 virtual gfx::Size GetMinimumSize() const override; | 56 gfx::Size GetMinimumSize() const override; |
| 57 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) | 57 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; |
| 58 override; | 58 void ViewHierarchyChanged( |
| 59 virtual void ViewHierarchyChanged( | |
| 60 const ViewHierarchyChangedDetails& details) override; | 59 const ViewHierarchyChangedDetails& details) override; |
| 61 virtual bool CanClose() override; | 60 bool CanClose() override; |
| 62 | 61 |
| 63 // Overridden from views::WidgetDelegate: | 62 // Overridden from views::WidgetDelegate: |
| 64 virtual bool CanResize() const override; | 63 bool CanResize() const override; |
| 65 virtual ui::ModalType GetModalType() const override; | 64 ui::ModalType GetModalType() const override; |
| 66 virtual base::string16 GetWindowTitle() const override; | 65 base::string16 GetWindowTitle() const override; |
| 67 virtual std::string GetWindowName() const override; | 66 std::string GetWindowName() const override; |
| 68 virtual void WindowClosing() override; | 67 void WindowClosing() override; |
| 69 virtual views::View* GetContentsView() override; | 68 views::View* GetContentsView() override; |
| 70 virtual ClientView* CreateClientView(views::Widget* widget) override; | 69 ClientView* CreateClientView(views::Widget* widget) override; |
| 71 virtual views::View* GetInitiallyFocusedView() override; | 70 views::View* GetInitiallyFocusedView() override; |
| 72 virtual bool ShouldShowWindowTitle() const override; | 71 bool ShouldShowWindowTitle() const override; |
| 73 virtual views::Widget* GetWidget() override; | 72 views::Widget* GetWidget() override; |
| 74 virtual const views::Widget* GetWidget() const override; | 73 const views::Widget* GetWidget() const override; |
| 75 | 74 |
| 76 // Overridden from ui::WebDialogDelegate: | 75 // Overridden from ui::WebDialogDelegate: |
| 77 virtual ui::ModalType GetDialogModalType() const override; | 76 ui::ModalType GetDialogModalType() const override; |
| 78 virtual base::string16 GetDialogTitle() const override; | 77 base::string16 GetDialogTitle() const override; |
| 79 virtual GURL GetDialogContentURL() const override; | 78 GURL GetDialogContentURL() const override; |
| 80 virtual void GetWebUIMessageHandlers( | 79 void GetWebUIMessageHandlers( |
| 81 std::vector<content::WebUIMessageHandler*>* handlers) const override; | 80 std::vector<content::WebUIMessageHandler*>* handlers) const override; |
| 82 virtual void GetDialogSize(gfx::Size* size) const override; | 81 void GetDialogSize(gfx::Size* size) const override; |
| 83 virtual void GetMinimumDialogSize(gfx::Size* size) const override; | 82 void GetMinimumDialogSize(gfx::Size* size) const override; |
| 84 virtual std::string GetDialogArgs() const override; | 83 std::string GetDialogArgs() const override; |
| 85 virtual void OnDialogShown( | 84 void OnDialogShown(content::WebUI* webui, |
| 86 content::WebUI* webui, | 85 content::RenderViewHost* render_view_host) override; |
| 87 content::RenderViewHost* render_view_host) override; | 86 void OnDialogClosed(const std::string& json_retval) override; |
| 88 virtual void OnDialogClosed(const std::string& json_retval) override; | 87 void OnDialogCloseFromWebUI(const std::string& json_retval) override; |
| 89 virtual void OnDialogCloseFromWebUI( | 88 void OnCloseContents(content::WebContents* source, |
| 90 const std::string& json_retval) override; | 89 bool* out_close_dialog) override; |
| 91 virtual void OnCloseContents(content::WebContents* source, | 90 bool ShouldShowDialogTitle() const override; |
| 92 bool* out_close_dialog) override; | 91 bool HandleContextMenu(const content::ContextMenuParams& params) override; |
| 93 virtual bool ShouldShowDialogTitle() const override; | |
| 94 virtual bool HandleContextMenu( | |
| 95 const content::ContextMenuParams& params) override; | |
| 96 | 92 |
| 97 // Overridden from content::WebContentsDelegate: | 93 // Overridden from content::WebContentsDelegate: |
| 98 virtual void MoveContents(content::WebContents* source, | 94 void MoveContents(content::WebContents* source, |
| 99 const gfx::Rect& pos) override; | 95 const gfx::Rect& pos) override; |
| 100 virtual void HandleKeyboardEvent( | 96 void HandleKeyboardEvent( |
| 101 content::WebContents* source, | 97 content::WebContents* source, |
| 102 const content::NativeWebKeyboardEvent& event) override; | 98 const content::NativeWebKeyboardEvent& event) override; |
| 103 virtual void CloseContents(content::WebContents* source) override; | 99 void CloseContents(content::WebContents* source) override; |
| 104 virtual content::WebContents* OpenURLFromTab( | 100 content::WebContents* OpenURLFromTab( |
| 105 content::WebContents* source, | 101 content::WebContents* source, |
| 106 const content::OpenURLParams& params) override; | 102 const content::OpenURLParams& params) override; |
| 107 virtual void AddNewContents(content::WebContents* source, | 103 void AddNewContents(content::WebContents* source, |
| 108 content::WebContents* new_contents, | 104 content::WebContents* new_contents, |
| 109 WindowOpenDisposition disposition, | 105 WindowOpenDisposition disposition, |
| 110 const gfx::Rect& initial_pos, | 106 const gfx::Rect& initial_pos, |
| 111 bool user_gesture, | 107 bool user_gesture, |
| 112 bool* was_blocked) override; | 108 bool* was_blocked) override; |
| 113 virtual void LoadingStateChanged(content::WebContents* source, | 109 void LoadingStateChanged(content::WebContents* source, |
| 114 bool to_different_document) override; | 110 bool to_different_document) override; |
| 115 virtual void BeforeUnloadFired(content::WebContents* tab, | 111 void BeforeUnloadFired(content::WebContents* tab, |
| 116 bool proceed, | 112 bool proceed, |
| 117 bool* proceed_to_fire_unload) override; | 113 bool* proceed_to_fire_unload) override; |
| 118 | 114 |
| 119 private: | 115 private: |
| 120 FRIEND_TEST_ALL_PREFIXES(WebDialogBrowserTest, WebContentRendered); | 116 FRIEND_TEST_ALL_PREFIXES(WebDialogBrowserTest, WebContentRendered); |
| 121 | 117 |
| 122 // Initializes the contents of the dialog. | 118 // Initializes the contents of the dialog. |
| 123 void InitDialog(); | 119 void InitDialog(); |
| 124 | 120 |
| 125 // This view is a delegate to the HTML content since it needs to get notified | 121 // This view is a delegate to the HTML content since it needs to get notified |
| 126 // about when the dialog is closing. For all other actions (besides dialog | 122 // about when the dialog is closing. For all other actions (besides dialog |
| 127 // closing) we delegate to the creator of this view, which we keep track of | 123 // closing) we delegate to the creator of this view, which we keep track of |
| (...skipping 19 matching lines...) Expand all Loading... |
| 147 | 143 |
| 148 // Whether CloseContents() has been called. | 144 // Whether CloseContents() has been called. |
| 149 bool close_contents_called_; | 145 bool close_contents_called_; |
| 150 | 146 |
| 151 DISALLOW_COPY_AND_ASSIGN(WebDialogView); | 147 DISALLOW_COPY_AND_ASSIGN(WebDialogView); |
| 152 }; | 148 }; |
| 153 | 149 |
| 154 } // namespace views | 150 } // namespace views |
| 155 | 151 |
| 156 #endif // UI_VIEWS_CONTROLS_WEBVIEW_WEB_DIALOG_VIEW_H_ | 152 #endif // UI_VIEWS_CONTROLS_WEBVIEW_WEB_DIALOG_VIEW_H_ |
| OLD | NEW |