| 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_BROWSER_NAVIGATOR_H_ | 5 #ifndef CHROME_BROWSER_UI_BROWSER_NAVIGATOR_H_ |
| 6 #define CHROME_BROWSER_UI_BROWSER_NAVIGATOR_H_ | 6 #define CHROME_BROWSER_UI_BROWSER_NAVIGATOR_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 // Simple Navigate to URL in current tab: | 28 // Simple Navigate to URL in current tab: |
| 29 // browser::NavigateParams params(browser, GURL("http://www.google.com/"), | 29 // browser::NavigateParams params(browser, GURL("http://www.google.com/"), |
| 30 // PageTransition::LINK); | 30 // PageTransition::LINK); |
| 31 // browser::Navigate(¶ms); | 31 // browser::Navigate(¶ms); |
| 32 // | 32 // |
| 33 // Open bookmark in new background tab: | 33 // Open bookmark in new background tab: |
| 34 // browser::NavigateParams params(browser, url, PageTransition::AUTO_BOOKMARK); | 34 // browser::NavigateParams params(browser, url, PageTransition::AUTO_BOOKMARK); |
| 35 // params.disposition = NEW_BACKGROUND_TAB; | 35 // params.disposition = NEW_BACKGROUND_TAB; |
| 36 // browser::Navigate(¶ms); | 36 // browser::Navigate(¶ms); |
| 37 // | 37 // |
| 38 // Opens a popup TabContents: | 38 // Opens a popup TabContentsWrapper: |
| 39 // browser::NavigateParams params(browser, popup_contents); | 39 // browser::NavigateParams params(browser, popup_contents); |
| 40 // params.source_contents = source_contents; | 40 // params.source_contents = source_contents; |
| 41 // browser::Navigate(¶ms); | 41 // browser::Navigate(¶ms); |
| 42 // | 42 // |
| 43 // See browser_navigator_browsertest.cc for more examples. | 43 // See browser_navigator_browsertest.cc for more examples. |
| 44 // | 44 // |
| 45 struct NavigateParams { | 45 struct NavigateParams { |
| 46 NavigateParams(Browser* browser, | 46 NavigateParams(Browser* browser, |
| 47 const GURL& a_url, | 47 const GURL& a_url, |
| 48 content::PageTransition a_transition); | 48 content::PageTransition a_transition); |
| 49 NavigateParams(Browser* browser, TabContentsWrapper* a_target_contents); | 49 NavigateParams(Browser* browser, TabContentsWrapper* a_target_contents); |
| 50 ~NavigateParams(); | 50 ~NavigateParams(); |
| 51 | 51 |
| 52 // The URL/referrer to be loaded. Ignored if |target_contents| is non-NULL. | 52 // The URL/referrer to be loaded. Ignored if |target_contents| is non-NULL. |
| 53 GURL url; | 53 GURL url; |
| 54 content::Referrer referrer; | 54 content::Referrer referrer; |
| 55 | 55 |
| 56 // [in] A TabContents to be navigated or inserted into the target Browser's | 56 // [in] A TabContentsWrapper to be navigated or inserted into the target |
| 57 // tabstrip. If NULL, |url| or the homepage will be used instead. When | 57 // Browser's tabstrip. If NULL, |url| or the homepage will be used |
| 58 // non-NULL, Navigate() assumes it has already been navigated to its | 58 // instead. When non-NULL, Navigate() assumes it has already been |
| 59 // intended destination and will not load any URL in it (i.e. |url| is | 59 // navigated to its intended destination and will not load any URL in it |
| 60 // ignored). | 60 // (i.e. |url| is ignored). |
| 61 // Default is NULL. | 61 // Default is NULL. |
| 62 // [out] The TabContents in which the navigation occurred or that was | 62 // [out] The TabContentsWrapper in which the navigation occurred or that was |
| 63 // inserted. Guaranteed non-NULL except for note below: | 63 // inserted. Guaranteed non-NULL except for note below: |
| 64 // Note: If this field is set to NULL by the caller and Navigate() creates | 64 // Note: If this field is set to NULL by the caller and Navigate() creates |
| 65 // a new TabContents, this field will remain NULL and the TabContents | 65 // a new TabContentsWrapper, this field will remain NULL and the |
| 66 // deleted if the TabContents it created is not added to a TabStripModel | 66 // TabContentsWrapper deleted if the TabContentsWrapper it created is |
| 67 // before Navigate() returns. | 67 // not added to a TabStripModel before Navigate() returns. |
| 68 TabContentsWrapper* target_contents; | 68 TabContentsWrapper* target_contents; |
| 69 | 69 |
| 70 // [in] The TabContents that initiated the Navigate() request if such context | 70 // [in] The TabContentsWrapper that initiated the Navigate() request if such |
| 71 // is necessary. Default is NULL, i.e. no context. | 71 // context is necessary. Default is NULL, i.e. no context. |
| 72 // [out] If NULL, this value will be set to the selected TabContents in the | 72 // [out] If NULL, this value will be set to the selected TabContentsWrapper in |
| 73 // originating browser prior to the operation performed by Navigate(). | 73 // the originating browser prior to the operation performed by |
| 74 // However, if the originating page is from a different profile (e.g. an | 74 // Navigate(). However, if the originating page is from a different |
| 75 // OFF_THE_RECORD page originating from a non-OTR window), then | 75 // profile (e.g. an OFF_THE_RECORD page originating from a non-OTR |
| 76 // |source_contents| is reset to NULL. | 76 // window), then |source_contents| is reset to NULL. |
| 77 TabContentsWrapper* source_contents; | 77 TabContentsWrapper* source_contents; |
| 78 | 78 |
| 79 // The disposition requested by the navigation source. Default is | 79 // The disposition requested by the navigation source. Default is |
| 80 // CURRENT_TAB. What follows is a set of coercions that happen to this value | 80 // CURRENT_TAB. What follows is a set of coercions that happen to this value |
| 81 // when other factors are at play: | 81 // when other factors are at play: |
| 82 // | 82 // |
| 83 // [in]: Condition: [out]: | 83 // [in]: Condition: [out]: |
| 84 // NEW_BACKGROUND_TAB target browser tabstrip is empty NEW_FOREGROUND_TAB | 84 // NEW_BACKGROUND_TAB target browser tabstrip is empty NEW_FOREGROUND_TAB |
| 85 // CURRENT_TAB " " " NEW_FOREGROUND_TAB | 85 // CURRENT_TAB " " " NEW_FOREGROUND_TAB |
| 86 // OFF_THE_RECORD target browser profile is incog. NEW_FOREGROUND_TAB | 86 // OFF_THE_RECORD target browser profile is incog. NEW_FOREGROUND_TAB |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 #if defined(OS_CHROMEOS) || defined(USE_AURA) | 204 #if defined(OS_CHROMEOS) || defined(USE_AURA) |
| 205 // Returns NEW_FOREGROUND_TAB if popup_bounds exceeds a specified percentage | 205 // Returns NEW_FOREGROUND_TAB if popup_bounds exceeds a specified percentage |
| 206 // of the window size, otherwise returns NEW_POPUP. | 206 // of the window size, otherwise returns NEW_POPUP. |
| 207 WindowOpenDisposition DispositionForPopupBounds( | 207 WindowOpenDisposition DispositionForPopupBounds( |
| 208 const gfx::Rect& popup_bounds, int window_width, int window_height); | 208 const gfx::Rect& popup_bounds, int window_width, int window_height); |
| 209 #endif | 209 #endif |
| 210 | 210 |
| 211 } // namespace browser | 211 } // namespace browser |
| 212 | 212 |
| 213 #endif // CHROME_BROWSER_UI_BROWSER_NAVIGATOR_H_ | 213 #endif // CHROME_BROWSER_UI_BROWSER_NAVIGATOR_H_ |
| OLD | NEW |