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

Side by Side Diff: chrome/browser/ui/webui/web_dialog_web_contents_delegate.cc

Issue 10698068: chrome: Put browser_navigator.h into chrome namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: already in chrome namespace Created 8 years, 5 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) 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 #include "chrome/browser/ui/webui/web_dialog_web_contents_delegate.h" 5 #include "chrome/browser/ui/webui/web_dialog_web_contents_delegate.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_navigator.h" 9 #include "chrome/browser/ui/browser_navigator.h"
10 #include "chrome/browser/ui/tab_contents/tab_contents.h" 10 #include "chrome/browser/ui/tab_contents/tab_contents.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // static 44 // static
45 Browser* WebDialogWebContentsDelegate::StaticOpenURLFromTab( 45 Browser* WebDialogWebContentsDelegate::StaticOpenURLFromTab(
46 Profile* profile, WebContents* source, const OpenURLParams& params, 46 Profile* profile, WebContents* source, const OpenURLParams& params,
47 WebContents** out_new_contents) { 47 WebContents** out_new_contents) {
48 if (!profile) 48 if (!profile)
49 return NULL; 49 return NULL;
50 50
51 // Specify a NULL browser for navigation. This will cause Navigate() 51 // Specify a NULL browser for navigation. This will cause Navigate()
52 // to find a browser matching params.profile or create a new one. 52 // to find a browser matching params.profile or create a new one.
53 Browser* browser = NULL; 53 Browser* browser = NULL;
54 browser::NavigateParams nav_params(browser, params.url, params.transition); 54 chrome::NavigateParams nav_params(browser, params.url, params.transition);
55 nav_params.profile = profile; 55 nav_params.profile = profile;
56 nav_params.referrer = params.referrer; 56 nav_params.referrer = params.referrer;
57 if (source && source->IsCrashed() && 57 if (source && source->IsCrashed() &&
58 params.disposition == CURRENT_TAB && 58 params.disposition == CURRENT_TAB &&
59 params.transition == content::PAGE_TRANSITION_LINK) { 59 params.transition == content::PAGE_TRANSITION_LINK) {
60 nav_params.disposition = NEW_FOREGROUND_TAB; 60 nav_params.disposition = NEW_FOREGROUND_TAB;
61 } else { 61 } else {
62 nav_params.disposition = params.disposition; 62 nav_params.disposition = params.disposition;
63 } 63 }
64 nav_params.window_action = browser::NavigateParams::SHOW_WINDOW; 64 nav_params.window_action = chrome::NavigateParams::SHOW_WINDOW;
65 nav_params.user_gesture = true; 65 nav_params.user_gesture = true;
66 browser::Navigate(&nav_params); 66 chrome::Navigate(&nav_params);
67 *out_new_contents = nav_params.target_contents ? 67 *out_new_contents = nav_params.target_contents ?
68 nav_params.target_contents->web_contents() : NULL; 68 nav_params.target_contents->web_contents() : NULL;
69 return nav_params.browser; 69 return nav_params.browser;
70 } 70 }
71 71
72 void WebDialogWebContentsDelegate::AddNewContents( 72 void WebDialogWebContentsDelegate::AddNewContents(
73 WebContents* source, WebContents* new_contents, 73 WebContents* source, WebContents* new_contents,
74 WindowOpenDisposition disposition, const gfx::Rect& initial_pos, 74 WindowOpenDisposition disposition, const gfx::Rect& initial_pos,
75 bool user_gesture) { 75 bool user_gesture) {
76 StaticAddNewContents(profile_, source, new_contents, disposition, 76 StaticAddNewContents(profile_, source, new_contents, disposition,
77 initial_pos, user_gesture); 77 initial_pos, user_gesture);
78 } 78 }
79 79
80 // static 80 // static
81 Browser* WebDialogWebContentsDelegate::StaticAddNewContents( 81 Browser* WebDialogWebContentsDelegate::StaticAddNewContents(
82 Profile* profile, 82 Profile* profile,
83 WebContents* source, 83 WebContents* source,
84 WebContents* new_contents, 84 WebContents* new_contents,
85 WindowOpenDisposition disposition, 85 WindowOpenDisposition disposition,
86 const gfx::Rect& initial_pos, 86 const gfx::Rect& initial_pos,
87 bool user_gesture) { 87 bool user_gesture) {
88 if (!profile) 88 if (!profile)
89 return NULL; 89 return NULL;
90 90
91 // Specify a NULL browser for navigation. This will cause Navigate() 91 // Specify a NULL browser for navigation. This will cause Navigate()
92 // to find a browser matching params.profile or create a new one. 92 // to find a browser matching params.profile or create a new one.
93 Browser* browser = NULL; 93 Browser* browser = NULL;
94 94
95 TabContents* tab_contents = new TabContents(new_contents); 95 TabContents* tab_contents = new TabContents(new_contents);
96 browser::NavigateParams params(browser, tab_contents); 96 chrome::NavigateParams params(browser, tab_contents);
97 params.profile = profile; 97 params.profile = profile;
98 // TODO(pinkerton): no way to get a TabContents for this. 98 // TODO(pinkerton): no way to get a TabContents for this.
99 // params.source_contents = source; 99 // params.source_contents = source;
100 params.disposition = disposition; 100 params.disposition = disposition;
101 params.window_bounds = initial_pos; 101 params.window_bounds = initial_pos;
102 params.window_action = browser::NavigateParams::SHOW_WINDOW; 102 params.window_action = chrome::NavigateParams::SHOW_WINDOW;
103 params.user_gesture = true; 103 params.user_gesture = true;
104 browser::Navigate(&params); 104 chrome::Navigate(&params);
105 105
106 return params.browser; 106 return params.browser;
107 } 107 }
108 108
109 bool WebDialogWebContentsDelegate::IsPopupOrPanel( 109 bool WebDialogWebContentsDelegate::IsPopupOrPanel(
110 const WebContents* source) const { 110 const WebContents* source) const {
111 // This needs to return true so that we are allowed to be resized by our 111 // This needs to return true so that we are allowed to be resized by our
112 // contents. 112 // contents.
113 return true; 113 return true;
114 } 114 }
115 115
116 bool WebDialogWebContentsDelegate::ShouldAddNavigationToHistory( 116 bool WebDialogWebContentsDelegate::ShouldAddNavigationToHistory(
117 const history::HistoryAddPageArgs& add_page_args, 117 const history::HistoryAddPageArgs& add_page_args,
118 content::NavigationType navigation_type) { 118 content::NavigationType navigation_type) {
119 return false; 119 return false;
120 } 120 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/set_as_default_browser_ui.cc ('k') | chrome/browser/ui/webui/web_ui_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698