| 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_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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/ref_counted_memory.h" | 11 #include "base/memory/ref_counted_memory.h" |
| 12 #include "chrome/browser/ui/host_desktop.h" | 12 #include "chrome/browser/ui/host_desktop.h" |
| 13 #include "content/public/browser/browser_context.h" | 13 #include "content/public/browser/browser_context.h" |
| 14 #include "content/public/browser/global_request_id.h" | 14 #include "content/public/browser/global_request_id.h" |
| 15 #include "content/public/browser/page_navigator.h" | 15 #include "content/public/browser/page_navigator.h" |
| 16 #include "content/public/common/page_transition_types.h" | |
| 17 #include "content/public/common/referrer.h" | 16 #include "content/public/common/referrer.h" |
| 17 #include "ui/base/page_transition_types.h" |
| 18 #include "ui/base/window_open_disposition.h" | 18 #include "ui/base/window_open_disposition.h" |
| 19 #include "ui/gfx/rect.h" | 19 #include "ui/gfx/rect.h" |
| 20 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 21 | 21 |
| 22 class Browser; | 22 class Browser; |
| 23 class Profile; | 23 class Profile; |
| 24 | 24 |
| 25 namespace content { | 25 namespace content { |
| 26 class WebContents; | 26 class WebContents; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace chrome { | 29 namespace chrome { |
| 30 | 30 |
| 31 // Parameters that tell Navigate() what to do. | 31 // Parameters that tell Navigate() what to do. |
| 32 // | 32 // |
| 33 // Some basic examples: | 33 // Some basic examples: |
| 34 // | 34 // |
| 35 // Simple Navigate to URL in current tab: | 35 // Simple Navigate to URL in current tab: |
| 36 // chrome::NavigateParams params(browser, GURL("http://www.google.com/"), | 36 // chrome::NavigateParams params(browser, GURL("http://www.google.com/"), |
| 37 // content::PAGE_TRANSITION_LINK); | 37 // ui::PAGE_TRANSITION_LINK); |
| 38 // chrome::Navigate(¶ms); | 38 // chrome::Navigate(¶ms); |
| 39 // | 39 // |
| 40 // Open bookmark in new background tab: | 40 // Open bookmark in new background tab: |
| 41 // chrome::NavigateParams params(browser, url, | 41 // chrome::NavigateParams params(browser, url, |
| 42 // content::PAGE_TRANSITION_AUTO_BOOKMARK); | 42 // ui::PAGE_TRANSITION_AUTO_BOOKMARK); |
| 43 // params.disposition = NEW_BACKGROUND_TAB; | 43 // params.disposition = NEW_BACKGROUND_TAB; |
| 44 // chrome::Navigate(¶ms); | 44 // chrome::Navigate(¶ms); |
| 45 // | 45 // |
| 46 // Opens a popup WebContents: | 46 // Opens a popup WebContents: |
| 47 // chrome::NavigateParams params(browser, popup_contents); | 47 // chrome::NavigateParams params(browser, popup_contents); |
| 48 // params.source_contents = source_contents; | 48 // params.source_contents = source_contents; |
| 49 // chrome::Navigate(¶ms); | 49 // chrome::Navigate(¶ms); |
| 50 // | 50 // |
| 51 // See browser_navigator_browsertest.cc for more examples. | 51 // See browser_navigator_browsertest.cc for more examples. |
| 52 // | 52 // |
| 53 struct NavigateParams { | 53 struct NavigateParams { |
| 54 NavigateParams(Browser* browser, | 54 NavigateParams(Browser* browser, |
| 55 const GURL& a_url, | 55 const GURL& a_url, |
| 56 content::PageTransition a_transition); | 56 ui::PageTransition a_transition); |
| 57 NavigateParams(Browser* browser, | 57 NavigateParams(Browser* browser, |
| 58 content::WebContents* a_target_contents); | 58 content::WebContents* a_target_contents); |
| 59 NavigateParams(Profile* profile, | 59 NavigateParams(Profile* profile, |
| 60 const GURL& a_url, | 60 const GURL& a_url, |
| 61 content::PageTransition a_transition); | 61 ui::PageTransition a_transition); |
| 62 ~NavigateParams(); | 62 ~NavigateParams(); |
| 63 | 63 |
| 64 // The URL/referrer to be loaded. Ignored if |target_contents| is non-NULL. | 64 // The URL/referrer to be loaded. Ignored if |target_contents| is non-NULL. |
| 65 GURL url; | 65 GURL url; |
| 66 content::Referrer referrer; | 66 content::Referrer referrer; |
| 67 | 67 |
| 68 // The browser-global ID of the frame to navigate, or -1 for the main frame. | 68 // The browser-global ID of the frame to navigate, or -1 for the main frame. |
| 69 int64 frame_tree_node_id; | 69 int64 frame_tree_node_id; |
| 70 | 70 |
| 71 // Any redirect URLs that occurred for this navigation before |url|. | 71 // Any redirect URLs that occurred for this navigation before |url|. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 // removed from |tabstrip_add_types| automatically. | 122 // removed from |tabstrip_add_types| automatically. |
| 123 // If disposition is one of NEW_WINDOW, NEW_POPUP, NEW_FOREGROUND_TAB or | 123 // If disposition is one of NEW_WINDOW, NEW_POPUP, NEW_FOREGROUND_TAB or |
| 124 // SINGLETON_TAB, then TabStripModel::ADD_ACTIVE is automatically added to | 124 // SINGLETON_TAB, then TabStripModel::ADD_ACTIVE is automatically added to |
| 125 // |tabstrip_add_types|. | 125 // |tabstrip_add_types|. |
| 126 WindowOpenDisposition disposition; | 126 WindowOpenDisposition disposition; |
| 127 | 127 |
| 128 // Sets browser->is_trusted_source. Default is false. | 128 // Sets browser->is_trusted_source. Default is false. |
| 129 bool trusted_source; | 129 bool trusted_source; |
| 130 | 130 |
| 131 // The transition type of the navigation. Default is | 131 // The transition type of the navigation. Default is |
| 132 // content::PAGE_TRANSITION_LINK when target_contents is specified in the | 132 // ui::PAGE_TRANSITION_LINK when target_contents is specified in the |
| 133 // constructor. | 133 // constructor. |
| 134 content::PageTransition transition; | 134 ui::PageTransition transition; |
| 135 | 135 |
| 136 // Whether this navigation was initiated by the renderer process. Default is | 136 // Whether this navigation was initiated by the renderer process. Default is |
| 137 // false. | 137 // false. |
| 138 bool is_renderer_initiated; | 138 bool is_renderer_initiated; |
| 139 | 139 |
| 140 // The index the caller would like the tab to be positioned at in the | 140 // The index the caller would like the tab to be positioned at in the |
| 141 // TabStrip. The actual index will be determined by the TabHandler in | 141 // TabStrip. The actual index will be determined by the TabHandler in |
| 142 // accordance with |add_types|. Defaults to -1 (allows the TabHandler to | 142 // accordance with |add_types|. Defaults to -1 (allows the TabHandler to |
| 143 // decide). | 143 // decide). |
| 144 int tabstrip_index; | 144 int tabstrip_index; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 // Navigates according to the configuration specified in |params|. | 245 // Navigates according to the configuration specified in |params|. |
| 246 void Navigate(NavigateParams* params); | 246 void Navigate(NavigateParams* params); |
| 247 | 247 |
| 248 // Returns true if the url is allowed to open in incognito window. | 248 // Returns true if the url is allowed to open in incognito window. |
| 249 bool IsURLAllowedInIncognito(const GURL& url, | 249 bool IsURLAllowedInIncognito(const GURL& url, |
| 250 content::BrowserContext* browser_context); | 250 content::BrowserContext* browser_context); |
| 251 | 251 |
| 252 } // namespace chrome | 252 } // namespace chrome |
| 253 | 253 |
| 254 #endif // CHROME_BROWSER_UI_BROWSER_NAVIGATOR_H_ | 254 #endif // CHROME_BROWSER_UI_BROWSER_NAVIGATOR_H_ |
| OLD | NEW |