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

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

Issue 889403004: Rename initial_pos to initial_rect in ShowWidget and ShowView IPCs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 10 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
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/chrome_web_contents_handler.h" 5 #include "chrome/browser/ui/webui/chrome_web_contents_handler.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_finder.h" 9 #include "chrome/browser/ui/browser_finder.h"
10 #include "chrome/browser/ui/browser_navigator.h" 10 #include "chrome/browser/ui/browser_navigator.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // Close the browser if chrome::Navigate created a new one. 65 // Close the browser if chrome::Navigate created a new one.
66 if (browser_created && (browser != nav_params.browser)) 66 if (browser_created && (browser != nav_params.browser))
67 browser->window()->Close(); 67 browser->window()->Close();
68 68
69 return nav_params.target_contents; 69 return nav_params.target_contents;
70 } 70 }
71 71
72 // Creates a new tab with |new_contents|. |context| is the browser context that 72 // Creates a new tab with |new_contents|. |context| is the browser context that
73 // the browser should be owned by. |source| is the WebContent where the 73 // the browser should be owned by. |source| is the WebContent where the
74 // operation originated. |disposition| controls how the new tab should be 74 // operation originated. |disposition| controls how the new tab should be
75 // opened. |initial_pos| is the position of the window if a new window is 75 // opened. |initial_rect| is the position and size of the window if a new window
76 // created. |user_gesture| is true if the operation was started by a user 76 // is created. |user_gesture| is true if the operation was started by a user
77 // gesture. 77 // gesture.
78 void ChromeWebContentsHandler::AddNewContents( 78 void ChromeWebContentsHandler::AddNewContents(
79 content::BrowserContext* context, 79 content::BrowserContext* context,
80 WebContents* source, 80 WebContents* source,
81 WebContents* new_contents, 81 WebContents* new_contents,
82 WindowOpenDisposition disposition, 82 WindowOpenDisposition disposition,
83 const gfx::Rect& initial_pos, 83 const gfx::Rect& initial_rect,
84 bool user_gesture) { 84 bool user_gesture) {
85 if (!context) 85 if (!context)
86 return; 86 return;
87 87
88 Profile* profile = Profile::FromBrowserContext(context); 88 Profile* profile = Profile::FromBrowserContext(context);
89 89
90 chrome::HostDesktopType desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE; 90 chrome::HostDesktopType desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE;
91 if (source) { 91 if (source) {
92 Browser* source_browser = chrome::FindBrowserWithWebContents(source); 92 Browser* source_browser = chrome::FindBrowserWithWebContents(source);
93 if (source_browser) 93 if (source_browser)
94 desktop_type = source_browser->host_desktop_type(); 94 desktop_type = source_browser->host_desktop_type();
95 } 95 }
96 96
97 Browser* browser = chrome::FindTabbedBrowser(profile, false, desktop_type); 97 Browser* browser = chrome::FindTabbedBrowser(profile, false, desktop_type);
98 const bool browser_created = !browser; 98 const bool browser_created = !browser;
99 if (!browser) 99 if (!browser)
100 browser = new Browser( 100 browser = new Browser(
101 Browser::CreateParams(Browser::TYPE_TABBED, profile, desktop_type)); 101 Browser::CreateParams(Browser::TYPE_TABBED, profile, desktop_type));
102 chrome::NavigateParams params(browser, new_contents); 102 chrome::NavigateParams params(browser, new_contents);
103 params.source_contents = source; 103 params.source_contents = source;
104 params.disposition = disposition; 104 params.disposition = disposition;
105 params.window_bounds = initial_pos; 105 params.window_bounds = initial_rect;
106 params.window_action = chrome::NavigateParams::SHOW_WINDOW; 106 params.window_action = chrome::NavigateParams::SHOW_WINDOW;
107 params.user_gesture = true; 107 params.user_gesture = true;
108 chrome::Navigate(&params); 108 chrome::Navigate(&params);
109 109
110 // Close the browser if chrome::Navigate created a new one. 110 // Close the browser if chrome::Navigate created a new one.
111 if (browser_created && (browser != params.browser)) 111 if (browser_created && (browser != params.browser))
112 browser->window()->Close(); 112 browser->window()->Close();
113 } 113 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chrome_web_contents_handler.h ('k') | chromecast/browser/android/cast_window_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698