| 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 CHROME_BROWSER_UI_WEBUI_WEB_DIALOG_WEB_CONTENTS_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_WEB_DIALOG_WEB_CONTENTS_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_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 | 10 |
| 11 class Browser; | 11 class Browser; |
| 12 class Profile; | 12 class Profile; |
| 13 | 13 |
| 14 // This class implements (and mostly ignores) most of | 14 // This class implements (and mostly ignores) most of |
| 15 // content::WebContentsDelegate for use in a Web dialog. Subclasses need only | 15 // content::WebContentsDelegate for use in a Web dialog. Subclasses need only |
| 16 // override a few methods instead of the everything from | 16 // override a few methods instead of the everything from |
| 17 // content::WebContentsDelegate; this way, implementations on all platforms | 17 // content::WebContentsDelegate; this way, implementations on all platforms |
| 18 // behave consistently. | 18 // behave consistently. |
| 19 class WebDialogWebContentsDelegate : public content::WebContentsDelegate { | 19 class WebDialogWebContentsDelegate : public content::WebContentsDelegate { |
| 20 public: | 20 public: |
| 21 // Opens a new URL inside |source| (if source is NULL open in the current | 21 // Opens a new URL inside |source|. |profile| is the profile that the browser |
| 22 // front-most tab). |profile| is the profile that the browser should be owened | 22 // should be owned by. |params| contains the URL to open and various |
| 23 // by. |params| contains the URL to open and various attributes such as | 23 // attributes such as disposition. On return |out_new_contents| contains the |
| 24 // disposition. On return |out_new_contents| contains the WebContents the | 24 // WebContents the URL is opened in. Returns the browser spawned by the |
| 25 // URL is opened in. Returns the browser spawned by the operation. | 25 // operation. |
| 26 static Browser* StaticOpenURLFromTab(Profile* profile, | 26 static Browser* StaticOpenURLFromTab(Profile* profile, |
| 27 content::WebContents* source, | 27 content::WebContents* source, |
| 28 const content::OpenURLParams& params, | 28 const content::OpenURLParams& params, |
| 29 content::WebContents** out_new_contents); | 29 content::WebContents** out_new_contents); |
| 30 | 30 |
| 31 // Creates a new tab with |new_contents|. |profile| is the profile that the | 31 // Creates a new tab with |new_contents|. |profile| is the profile that the |
| 32 // browser should be owned by. |source| is the WebContent where the operation | 32 // browser should be owned by. |source| is the WebContent where the operation |
| 33 // originated. |disposition| controls how the new tab should be opened. | 33 // originated. |disposition| controls how the new tab should be opened. |
| 34 // |initial_pos| is the position of the window if a new window is created. | 34 // |initial_pos| is the position of the window if a new window is created. |
| 35 // |user_gesture| is true if the operation was started by a user gesture. | 35 // |user_gesture| is true if the operation was started by a user gesture. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 const history::HistoryAddPageArgs& add_page_args, | 70 const history::HistoryAddPageArgs& add_page_args, |
| 71 content::NavigationType navigation_type) OVERRIDE; | 71 content::NavigationType navigation_type) OVERRIDE; |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 Profile* profile_; // Weak pointer. Always an original profile. | 74 Profile* profile_; // Weak pointer. Always an original profile. |
| 75 | 75 |
| 76 DISALLOW_COPY_AND_ASSIGN(WebDialogWebContentsDelegate); | 76 DISALLOW_COPY_AND_ASSIGN(WebDialogWebContentsDelegate); |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 #endif // CHROME_BROWSER_UI_WEBUI_WEB_DIALOG_WEB_CONTENTS_DELEGATE_H_ | 79 #endif // CHROME_BROWSER_UI_WEBUI_WEB_DIALOG_WEB_CONTENTS_DELEGATE_H_ |
| OLD | NEW |