Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Side by Side Diff: chrome/browser/browser_navigator.h

Issue 3734003: Add support for SINGLETON_TAB disposition to BrowserNavigator.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_BROWSER_NAVIGATOR_H_ 5 #ifndef CHROME_BROWSER_BROWSER_NAVIGATOR_H_
6 #define CHROME_BROWSER_BROWSER_NAVIGATOR_H_ 6 #define CHROME_BROWSER_BROWSER_NAVIGATOR_H_
7 #pragma once
7 8
8 #include <string> 9 #include <string>
9 10
10 #include "chrome/common/page_transition_types.h" 11 #include "chrome/common/page_transition_types.h"
11 #include "gfx/rect.h" 12 #include "gfx/rect.h"
12 #include "googleurl/src/gurl.h" 13 #include "googleurl/src/gurl.h"
13 #include "webkit/glue/window_open_disposition.h" 14 #include "webkit/glue/window_open_disposition.h"
14 15
15 class Browser; 16 class Browser;
16 class Profile; 17 class Profile;
17 class TabContents; 18 class TabContents;
18 19
19 class NavigatorDelegate {
20 public:
21 // Called by Navigate() after a navigation in |contents| has been performed.
22 virtual void UpdateUIForNavigationInTab(TabContents* contents,
23 PageTransition::Type transition,
24 bool user_initiated) = 0;
25
26 // Returns the URL of the home page. This URL will be loaded if the URL
27 // specified in NavigateParams is empty.
28 virtual GURL GetHomePage() const = 0;
29
30 protected:
31 virtual ~NavigatorDelegate() {}
32 };
33
34 namespace browser { 20 namespace browser {
35 21
36 // Parameters that tell Navigate() what to do. 22 // Parameters that tell Navigate() what to do.
37 // 23 //
38 // Some basic examples: 24 // Some basic examples:
39 // 25 //
40 // Simple Navigate to URL in current tab: 26 // Simple Navigate to URL in current tab:
41 // browser::NavigateParams params(browser, GURL("http://www.google.com/"), 27 // browser::NavigateParams params(browser, GURL("http://www.google.com/"),
42 // PageTransition::LINK); 28 // PageTransition::LINK);
43 // browser::Navigate(&params, delegate); 29 // browser::Navigate(&params);
44 // 30 //
45 // Open bookmark in new background tab: 31 // Open bookmark in new background tab:
46 // browser::NavigateParams params(browser, url, PageTransition::AUTO_BOOKMARK); 32 // browser::NavigateParams params(browser, url, PageTransition::AUTO_BOOKMARK);
47 // params.disposition = NEW_BACKGROUND_TAB; 33 // params.disposition = NEW_BACKGROUND_TAB;
48 // browser::Navigate(&params, delegate); 34 // browser::Navigate(&params);
49 // 35 //
50 // Opens a popup TabContents: 36 // Opens a popup TabContents:
51 // browser::NavigateParams params(browser, popup_contents); 37 // browser::NavigateParams params(browser, popup_contents);
52 // params.source_contents = source_contents; 38 // params.source_contents = source_contents;
53 // browser::Navigate(&params, delegate); 39 // browser::Navigate(&params);
54 // 40 //
55 // See browser_navigator_browsertest.cc for more examples. 41 // See browser_navigator_browsertest.cc for more examples.
56 // 42 //
57 struct NavigateParams { 43 struct NavigateParams {
58 NavigateParams(Browser* browser, 44 NavigateParams(Browser* browser,
59 const GURL& a_url, 45 const GURL& a_url,
60 PageTransition::Type a_transition); 46 PageTransition::Type a_transition);
61 NavigateParams(Browser* browser, TabContents* a_target_contents); 47 NavigateParams(Browser* browser, TabContents* a_target_contents);
62 ~NavigateParams(); 48 ~NavigateParams();
63 49
64 // The URL/referrer to be loaded. Can be empty if |contents| is specified 50 // The URL/referrer to be loaded. Can be empty if |contents| is specified
65 // non-NULL. 51 // non-NULL.
66 GURL url; 52 GURL url;
67 GURL referrer; 53 GURL referrer;
68 54
69 // [in] A TabContents to be navigated or inserted into the target Browser's 55 // [in] A TabContents to be navigated or inserted into the target Browser's
70 // tabstrip. If NULL, |url| or the homepage supplied by the 56 // tabstrip. If NULL, |url| or the homepage will be used instead.
71 // NavigatorDelegate will be used instead. Default is NULL. 57 // Default is NULL.
72 // [out] The TabContents in which the navigation occurred or that was 58 // [out] The TabContents in which the navigation occurred or that was
73 // inserted. Guaranteed non-NULL except for note below: 59 // inserted. Guaranteed non-NULL except for note below:
74 // Note: If this field is set to NULL by the caller and Navigate() creates 60 // Note: If this field is set to NULL by the caller and Navigate() creates
75 // a new TabContents, this field will remain NULL and the TabContents 61 // a new TabContents, this field will remain NULL and the TabContents
76 // deleted if the TabContents it created is not added to a TabStripModel 62 // deleted if the TabContents it created is not added to a TabStripModel
77 // before Navigate() returns. 63 // before Navigate() returns.
78 TabContents* target_contents; 64 TabContents* target_contents;
79 65
80 // [in] The TabContents that initiated the Navigate() request if such context 66 // [in] The TabContents that initiated the Navigate() request if such context
81 // is necessary. Default is NULL, i.e. no context. 67 // is necessary. Default is NULL, i.e. no context.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // Navigate(), the caller is responsible for showing it so that its 114 // Navigate(), the caller is responsible for showing it so that its
129 // window can assume responsibility for the Browser's lifetime (Browser 115 // window can assume responsibility for the Browser's lifetime (Browser
130 // objects are deleted when the user closes a visible browser window). 116 // objects are deleted when the user closes a visible browser window).
131 Browser* browser; 117 Browser* browser;
132 118
133 private: 119 private:
134 NavigateParams(); 120 NavigateParams();
135 }; 121 };
136 122
137 // Navigates according to the configuration specified in |params|. 123 // Navigates according to the configuration specified in |params|.
138 void Navigate(NavigateParams* params, NavigatorDelegate* delegate); 124 void Navigate(NavigateParams* params);
139 125
140 } // namespace browser 126 } // namespace browser
141 127
142 #endif // CHROME_BROWSER_BROWSER_NAVIGATOR_H_ 128 #endif // CHROME_BROWSER_BROWSER_NAVIGATOR_H_
143 129
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698