OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_HTML_DIALOG_TAB_CONTENTS_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_HTML_DIALOG_TAB_CONTENTS_DELEGATE_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_HTML_DIALOG_TAB_CONTENTS_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_HTML_DIALOG_TAB_CONTENTS_DELEGATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "content/public/browser/web_contents_delegate.h" | 10 #include "content/public/browser/web_contents_delegate.h" |
11 | 11 |
| 12 class Browser; |
12 class Profile; | 13 class Profile; |
13 | 14 |
14 // This class implements (and mostly ignores) most of | 15 // This class implements (and mostly ignores) most of |
15 // content::WebContentsDelegate for use in an HTML dialog. Subclasses need only | 16 // content::WebContentsDelegate for use in an HTML dialog. Subclasses need only |
16 // override a few methods instead of the everything from | 17 // override a few methods instead of the everything from |
17 // content::WebContentsDelegate; this way, implementations on all platforms | 18 // content::WebContentsDelegate; this way, implementations on all platforms |
18 // behave consistently. | 19 // behave consistently. |
19 class HtmlDialogTabContentsDelegate : public content::WebContentsDelegate { | 20 class HtmlDialogTabContentsDelegate : public content::WebContentsDelegate { |
20 public: | 21 public: |
| 22 // Opens the URL. On return |out_new_contents| contains the WebContents the |
| 23 // URL is opened in. Returns the browser spawned by the operatoin. |
| 24 static Browser* StaticOpenURLFromTab(Profile* profile, |
| 25 content::WebContents* source, |
| 26 const content::OpenURLParams& params, |
| 27 content::WebContents** out_new_contents); |
| 28 |
| 29 // Creates a new tab with |new_contents|. Returns the browser spawned by the |
| 30 // operation. |
| 31 static Browser* StaticAddNewContents(Profile* profile, |
| 32 content::WebContents* source, |
| 33 content::WebContents* new_contents, |
| 34 WindowOpenDisposition disposition, |
| 35 const gfx::Rect& initial_pos, |
| 36 bool user_gesture); |
| 37 |
21 // Profile must be non-NULL. | 38 // Profile must be non-NULL. |
22 explicit HtmlDialogTabContentsDelegate(Profile* profile); | 39 explicit HtmlDialogTabContentsDelegate(Profile* profile); |
23 | 40 |
24 virtual ~HtmlDialogTabContentsDelegate(); | 41 virtual ~HtmlDialogTabContentsDelegate(); |
25 | 42 |
26 // The returned profile is guaranteed to be original if non-NULL. | 43 // The returned profile is guaranteed to be original if non-NULL. |
27 Profile* profile() const; | 44 Profile* profile() const; |
28 | 45 |
29 // Calling this causes all following events sent from the | 46 // Calling this causes all following events sent from the |
30 // TabContents object to be ignored. It also makes all following | 47 // TabContents object to be ignored. It also makes all following |
(...skipping 14 matching lines...) Expand all Loading... |
45 const content::WebContents* source) const OVERRIDE; | 62 const content::WebContents* source) const OVERRIDE; |
46 virtual bool ShouldAddNavigationToHistory( | 63 virtual bool ShouldAddNavigationToHistory( |
47 const history::HistoryAddPageArgs& add_page_args, | 64 const history::HistoryAddPageArgs& add_page_args, |
48 content::NavigationType navigation_type) OVERRIDE; | 65 content::NavigationType navigation_type) OVERRIDE; |
49 | 66 |
50 private: | 67 private: |
51 Profile* profile_; // Weak pointer. Always an original profile. | 68 Profile* profile_; // Weak pointer. Always an original profile. |
52 }; | 69 }; |
53 | 70 |
54 #endif // CHROME_BROWSER_UI_WEBUI_HTML_DIALOG_TAB_CONTENTS_DELEGATE_H_ | 71 #endif // CHROME_BROWSER_UI_WEBUI_HTML_DIALOG_TAB_CONTENTS_DELEGATE_H_ |
OLD | NEW |