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 a new URL inside |source| (if source is 0 open in the current | |
James Hawkins
2012/01/31 00:23:22
s/0/NULL/
sail
2012/01/31 01:03:46
Done.
| |
23 // front-most tab). |profile| is the profile that the browser should be owened | |
24 // by. |params| contains the URL to open and various attributes such as | |
25 // disposition. On return |out_new_contents| contains the WebContents the | |
26 // URL is opened in. Returns the browser spawned by the operation. | |
27 static Browser* StaticOpenURLFromTab(Profile* profile, | |
28 content::WebContents* source, | |
29 const content::OpenURLParams& params, | |
30 content::WebContents** out_new_contents); | |
31 | |
32 // Creates a new tab with |new_contents|. |profile| is the profile that the | |
33 // browser should be owned by. |source| is the WebContent where the operation | |
34 // originated. |disposition| controls how the new tab should be opened. | |
35 // |initial_pos| is the position of the window if a new window is created. | |
36 // |user_gesture| is true if the operation was started by a user gesture. | |
37 // Returns the browser spawned by the operation. | |
38 static Browser* StaticAddNewContents(Profile* profile, | |
39 content::WebContents* source, | |
40 content::WebContents* new_contents, | |
41 WindowOpenDisposition disposition, | |
42 const gfx::Rect& initial_pos, | |
43 bool user_gesture); | |
44 | |
21 // Profile must be non-NULL. | 45 // Profile must be non-NULL. |
22 explicit HtmlDialogTabContentsDelegate(Profile* profile); | 46 explicit HtmlDialogTabContentsDelegate(Profile* profile); |
23 | 47 |
24 virtual ~HtmlDialogTabContentsDelegate(); | 48 virtual ~HtmlDialogTabContentsDelegate(); |
25 | 49 |
26 // The returned profile is guaranteed to be original if non-NULL. | 50 // The returned profile is guaranteed to be original if non-NULL. |
27 Profile* profile() const; | 51 Profile* profile() const; |
28 | 52 |
29 // Calling this causes all following events sent from the | 53 // Calling this causes all following events sent from the |
30 // TabContents object to be ignored. It also makes all following | 54 // TabContents object to be ignored. It also makes all following |
(...skipping 14 matching lines...) Expand all Loading... | |
45 const content::WebContents* source) const OVERRIDE; | 69 const content::WebContents* source) const OVERRIDE; |
46 virtual bool ShouldAddNavigationToHistory( | 70 virtual bool ShouldAddNavigationToHistory( |
47 const history::HistoryAddPageArgs& add_page_args, | 71 const history::HistoryAddPageArgs& add_page_args, |
48 content::NavigationType navigation_type) OVERRIDE; | 72 content::NavigationType navigation_type) OVERRIDE; |
49 | 73 |
50 private: | 74 private: |
51 Profile* profile_; // Weak pointer. Always an original profile. | 75 Profile* profile_; // Weak pointer. Always an original profile. |
52 }; | 76 }; |
53 | 77 |
54 #endif // CHROME_BROWSER_UI_WEBUI_HTML_DIALOG_TAB_CONTENTS_DELEGATE_H_ | 78 #endif // CHROME_BROWSER_UI_WEBUI_HTML_DIALOG_TAB_CONTENTS_DELEGATE_H_ |
OLD | NEW |