| 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 CHROME_BROWSER_UI_WEBUI_WEB_DIALOG_WEB_CONTENTS_DELEGATE_H_ | 5 #ifndef UI_WEB_DIALOGS_WEB_DIALOG_WEB_CONTENTS_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_WEB_DIALOG_WEB_CONTENTS_DELEGATE_H_ | 6 #define UI_WEB_DIALOGS_WEB_DIALOG_WEB_CONTENTS_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "content/public/browser/web_contents_delegate.h" | 9 #include "content/public/browser/web_contents_delegate.h" |
| 10 #include "ui/web_dialogs/web_dialogs_export.h" |
| 11 |
| 12 namespace ui { |
| 10 | 13 |
| 11 // This class implements (and mostly ignores) most of | 14 // This class implements (and mostly ignores) most of |
| 12 // content::WebContentsDelegate for use in a Web dialog. Subclasses need only | 15 // content::WebContentsDelegate for use in a Web dialog. Subclasses need only |
| 13 // override a few methods instead of the everything from | 16 // override a few methods instead of the everything from |
| 14 // content::WebContentsDelegate; this way, implementations on all platforms | 17 // content::WebContentsDelegate; this way, implementations on all platforms |
| 15 // behave consistently. | 18 // behave consistently. |
| 16 class WebDialogWebContentsDelegate : public content::WebContentsDelegate { | 19 class WEB_DIALOGS_EXPORT WebDialogWebContentsDelegate |
| 20 : public content::WebContentsDelegate { |
| 17 public: | 21 public: |
| 18 // Handles OpenURLFromTab and AddNewContents for WebDialogWebContentsDelegate. | 22 // Handles OpenURLFromTab and AddNewContents for WebDialogWebContentsDelegate. |
| 19 class WebContentsHandler { | 23 class WebContentsHandler { |
| 20 public: | 24 public: |
| 21 virtual ~WebContentsHandler() {} | 25 virtual ~WebContentsHandler() {} |
| 22 virtual content::WebContents* OpenURLFromTab( | 26 virtual content::WebContents* OpenURLFromTab( |
| 23 content::BrowserContext* context, | 27 content::BrowserContext* context, |
| 24 content::WebContents* source, | 28 content::WebContents* source, |
| 25 const content::OpenURLParams& params) = 0; | 29 const content::OpenURLParams& params) = 0; |
| 26 virtual void AddNewContents(content::BrowserContext* context, | 30 virtual void AddNewContents(content::BrowserContext* context, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 70 |
| 67 private: | 71 private: |
| 68 // Weak pointer. Always an original profile. | 72 // Weak pointer. Always an original profile. |
| 69 content::BrowserContext* browser_context_; | 73 content::BrowserContext* browser_context_; |
| 70 | 74 |
| 71 scoped_ptr<WebContentsHandler> handler_; | 75 scoped_ptr<WebContentsHandler> handler_; |
| 72 | 76 |
| 73 DISALLOW_COPY_AND_ASSIGN(WebDialogWebContentsDelegate); | 77 DISALLOW_COPY_AND_ASSIGN(WebDialogWebContentsDelegate); |
| 74 }; | 78 }; |
| 75 | 79 |
| 76 #endif // CHROME_BROWSER_UI_WEBUI_WEB_DIALOG_WEB_CONTENTS_DELEGATE_H_ | 80 } // namespace ui |
| 81 |
| 82 #endif // UI_WEB_DIALOGS_WEB_DIALOG_WEB_CONTENTS_DELEGATE_H_ |
| OLD | NEW |