| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "content/public/browser/global_request_id.h" | 11 #include "content/public/browser/global_request_id.h" |
| 12 #include "content/public/common/page_transition_types.h" | 12 #include "content/public/common/page_transition_types.h" |
| 13 #include "content/public/common/referrer.h" | 13 #include "content/public/common/referrer.h" |
| 14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
| 15 #include "ui/gfx/rect.h" | 15 #include "ui/gfx/rect.h" |
| 16 #include "webkit/glue/window_open_disposition.h" | 16 #include "webkit/glue/window_open_disposition.h" |
| 17 | 17 |
| 18 class Browser; | 18 class Browser; |
| 19 class Profile; | 19 class Profile; |
| 20 class TabContents; | 20 class TabContents; |
| 21 | 21 |
| 22 namespace browser { | 22 namespace chrome { |
| 23 | 23 |
| 24 // Parameters that tell Navigate() what to do. | 24 // Parameters that tell Navigate() what to do. |
| 25 // | 25 // |
| 26 // Some basic examples: | 26 // Some basic examples: |
| 27 // | 27 // |
| 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 // chrome::NavigateParams params(browser, GURL("http://www.google.com/"), |
| 30 // PageTransition::LINK); | 30 // content::PAGE_TRANSITION_LINK); |
| 31 // browser::Navigate(¶ms); | 31 // chrome::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 // chrome::NavigateParams params(browser, url, |
| 35 // content::PAGE_TRANSITION_AUTO_BOOKMARK); |
| 35 // params.disposition = NEW_BACKGROUND_TAB; | 36 // params.disposition = NEW_BACKGROUND_TAB; |
| 36 // browser::Navigate(¶ms); | 37 // chrome::Navigate(¶ms); |
| 37 // | 38 // |
| 38 // Opens a popup TabContents: | 39 // Opens a popup TabContents: |
| 39 // browser::NavigateParams params(browser, popup_contents); | 40 // chrome::NavigateParams params(browser, popup_contents); |
| 40 // params.source_contents = source_contents; | 41 // params.source_contents = source_contents; |
| 41 // browser::Navigate(¶ms); | 42 // chrome::Navigate(¶ms); |
| 42 // | 43 // |
| 43 // See browser_navigator_browsertest.cc for more examples. | 44 // See browser_navigator_browsertest.cc for more examples. |
| 44 // | 45 // |
| 45 struct NavigateParams { | 46 struct NavigateParams { |
| 46 NavigateParams(Browser* browser, | 47 NavigateParams(Browser* browser, |
| 47 const GURL& a_url, | 48 const GURL& a_url, |
| 48 content::PageTransition a_transition); | 49 content::PageTransition a_transition); |
| 49 NavigateParams(Browser* browser, TabContents* a_target_contents); | 50 NavigateParams(Browser* browser, TabContents* a_target_contents); |
| 50 ~NavigateParams(); | 51 ~NavigateParams(); |
| 51 | 52 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // CURRENT_TAB " " " NEW_FOREGROUND_TAB | 86 // CURRENT_TAB " " " NEW_FOREGROUND_TAB |
| 86 // OFF_THE_RECORD target browser profile is incog. NEW_FOREGROUND_TAB | 87 // OFF_THE_RECORD target browser profile is incog. NEW_FOREGROUND_TAB |
| 87 // | 88 // |
| 88 // If disposition is NEW_BACKGROUND_TAB, TabStripModel::ADD_ACTIVE is | 89 // If disposition is NEW_BACKGROUND_TAB, TabStripModel::ADD_ACTIVE is |
| 89 // removed from |tabstrip_add_types| automatically. | 90 // removed from |tabstrip_add_types| automatically. |
| 90 // If disposition is one of NEW_WINDOW, NEW_POPUP, NEW_FOREGROUND_TAB or | 91 // If disposition is one of NEW_WINDOW, NEW_POPUP, NEW_FOREGROUND_TAB or |
| 91 // SINGLETON_TAB, then TabStripModel::ADD_ACTIVE is automatically added to | 92 // SINGLETON_TAB, then TabStripModel::ADD_ACTIVE is automatically added to |
| 92 // |tabstrip_add_types|. | 93 // |tabstrip_add_types|. |
| 93 WindowOpenDisposition disposition; | 94 WindowOpenDisposition disposition; |
| 94 | 95 |
| 95 // The transition type of the navigation. Default is PageTransition::LINK | 96 // The transition type of the navigation. Default is |
| 96 // when target_contents is specified in the constructor. | 97 // content::PAGE_TRANSITION_LINK when target_contents is specified in the |
| 98 // constructor. |
| 97 content::PageTransition transition; | 99 content::PageTransition transition; |
| 98 | 100 |
| 99 // Whether this navigation was initiated by the renderer process. | 101 // Whether this navigation was initiated by the renderer process. |
| 100 bool is_renderer_initiated; | 102 bool is_renderer_initiated; |
| 101 | 103 |
| 102 // The index the caller would like the tab to be positioned at in the | 104 // The index the caller would like the tab to be positioned at in the |
| 103 // TabStrip. The actual index will be determined by the TabHandler in | 105 // TabStrip. The actual index will be determined by the TabHandler in |
| 104 // accordance with |add_types|. Defaults to -1 (allows the TabHandler to | 106 // accordance with |add_types|. Defaults to -1 (allows the TabHandler to |
| 105 // decide). | 107 // decide). |
| 106 int tabstrip_index; | 108 int tabstrip_index; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 private: | 192 private: |
| 191 NavigateParams(); | 193 NavigateParams(); |
| 192 }; | 194 }; |
| 193 | 195 |
| 194 // Navigates according to the configuration specified in |params|. | 196 // Navigates according to the configuration specified in |params|. |
| 195 void Navigate(NavigateParams* params); | 197 void Navigate(NavigateParams* params); |
| 196 | 198 |
| 197 // Returns true if the url is allowed to open in incognito window. | 199 // Returns true if the url is allowed to open in incognito window. |
| 198 bool IsURLAllowedInIncognito(const GURL& url); | 200 bool IsURLAllowedInIncognito(const GURL& url); |
| 199 | 201 |
| 200 } // namespace browser | 202 } // namespace chrome |
| 201 | 203 |
| 202 #endif // CHROME_BROWSER_UI_BROWSER_NAVIGATOR_H_ | 204 #endif // CHROME_BROWSER_UI_BROWSER_NAVIGATOR_H_ |
| OLD | NEW |