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 #include "chrome/browser/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #endif // OS_WIN | 10 #endif // OS_WIN |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 253 |
254 //////////////////////////////////////////////////////////////////////////////// | 254 //////////////////////////////////////////////////////////////////////////////// |
255 // Browser, CreateParams: | 255 // Browser, CreateParams: |
256 | 256 |
257 Browser::CreateParams::CreateParams() | 257 Browser::CreateParams::CreateParams() |
258 : type(TYPE_TABBED), | 258 : type(TYPE_TABBED), |
259 profile(NULL), | 259 profile(NULL), |
260 host_desktop_type(kDefaultHostDesktopType), | 260 host_desktop_type(kDefaultHostDesktopType), |
261 app_type(APP_TYPE_HOST), | 261 app_type(APP_TYPE_HOST), |
262 initial_show_state(ui::SHOW_STATE_DEFAULT), | 262 initial_show_state(ui::SHOW_STATE_DEFAULT), |
| 263 initial_user_has_changed_window_or_position(false), |
263 is_session_restore(false), | 264 is_session_restore(false), |
264 window(NULL) { | 265 window(NULL) { |
265 } | 266 } |
266 | 267 |
267 Browser::CreateParams::CreateParams(Profile* profile) | 268 Browser::CreateParams::CreateParams(Profile* profile) |
268 : type(TYPE_TABBED), | 269 : type(TYPE_TABBED), |
269 profile(profile), | 270 profile(profile), |
270 host_desktop_type(kDefaultHostDesktopType), | 271 host_desktop_type(kDefaultHostDesktopType), |
271 app_type(APP_TYPE_HOST), | 272 app_type(APP_TYPE_HOST), |
272 initial_show_state(ui::SHOW_STATE_DEFAULT), | 273 initial_show_state(ui::SHOW_STATE_DEFAULT), |
| 274 initial_user_has_changed_window_or_position(false), |
273 is_session_restore(false), | 275 is_session_restore(false), |
274 window(NULL) { | 276 window(NULL) { |
275 } | 277 } |
276 | 278 |
277 Browser::CreateParams::CreateParams(Type type, Profile* profile) | 279 Browser::CreateParams::CreateParams(Type type, Profile* profile) |
278 : type(type), | 280 : type(type), |
279 profile(profile), | 281 profile(profile), |
280 host_desktop_type(kDefaultHostDesktopType), | 282 host_desktop_type(kDefaultHostDesktopType), |
281 app_type(APP_TYPE_HOST), | 283 app_type(APP_TYPE_HOST), |
282 initial_show_state(ui::SHOW_STATE_DEFAULT), | 284 initial_show_state(ui::SHOW_STATE_DEFAULT), |
| 285 initial_user_has_changed_window_or_position(false), |
283 is_session_restore(false), | 286 is_session_restore(false), |
284 window(NULL) { | 287 window(NULL) { |
285 } | 288 } |
286 | 289 |
287 Browser::CreateParams::CreateParams(Type type, | 290 Browser::CreateParams::CreateParams(Type type, |
288 Profile* profile, | 291 Profile* profile, |
289 chrome::HostDesktopType host_desktop_type) | 292 chrome::HostDesktopType host_desktop_type) |
290 : type(type), | 293 : type(type), |
291 profile(profile), | 294 profile(profile), |
292 host_desktop_type(host_desktop_type), | 295 host_desktop_type(host_desktop_type), |
293 app_type(APP_TYPE_HOST), | 296 app_type(APP_TYPE_HOST), |
294 initial_show_state(ui::SHOW_STATE_DEFAULT), | 297 initial_show_state(ui::SHOW_STATE_DEFAULT), |
| 298 initial_user_has_changed_window_or_position(false), |
295 is_session_restore(false), | 299 is_session_restore(false), |
296 window(NULL) { | 300 window(NULL) { |
297 } | 301 } |
298 | 302 |
299 // static | 303 // static |
300 Browser::CreateParams Browser::CreateParams::CreateForApp( | 304 Browser::CreateParams Browser::CreateParams::CreateForApp( |
301 Type type, | 305 Type type, |
302 const std::string& app_name, | 306 const std::string& app_name, |
303 const gfx::Rect& window_bounds, | 307 const gfx::Rect& window_bounds, |
304 Profile* profile) { | 308 Profile* profile) { |
305 DCHECK(type != TYPE_TABBED); | 309 DCHECK(type != TYPE_TABBED); |
306 DCHECK(!app_name.empty()); | 310 DCHECK(!app_name.empty()); |
307 | 311 |
308 CreateParams params(type, profile); | 312 CreateParams params(type, profile); |
309 params.app_name = app_name; | 313 params.app_name = app_name; |
310 params.app_type = APP_TYPE_CHILD; | 314 params.app_type = APP_TYPE_CHILD; |
311 params.initial_bounds = window_bounds; | 315 params.initial_bounds = window_bounds; |
| 316 params.initial_user_has_changed_window_or_position = false; |
312 | 317 |
313 return params; | 318 return params; |
314 } | 319 } |
315 | 320 |
316 // static | 321 // static |
317 Browser::CreateParams Browser::CreateParams::CreateForDevTools( | 322 Browser::CreateParams Browser::CreateParams::CreateForDevTools( |
318 Profile* profile) { | 323 Profile* profile) { |
319 CreateParams params(TYPE_POPUP, profile); | 324 CreateParams params(TYPE_POPUP, profile); |
320 params.app_name = DevToolsWindow::kDevToolsApp; | 325 params.app_name = DevToolsWindow::kDevToolsApp; |
321 return params; | 326 return params; |
(...skipping 11 matching lines...) Expand all Loading... |
333 new chrome::BrowserTabStripModelDelegate(this))), | 338 new chrome::BrowserTabStripModelDelegate(this))), |
334 ALLOW_THIS_IN_INITIALIZER_LIST( | 339 ALLOW_THIS_IN_INITIALIZER_LIST( |
335 tab_strip_model_(new TabStripModel(tab_strip_model_delegate_.get(), | 340 tab_strip_model_(new TabStripModel(tab_strip_model_delegate_.get(), |
336 params.profile))), | 341 params.profile))), |
337 app_name_(params.app_name), | 342 app_name_(params.app_name), |
338 app_type_(params.app_type), | 343 app_type_(params.app_type), |
339 chrome_updater_factory_(this), | 344 chrome_updater_factory_(this), |
340 cancel_download_confirmation_state_(NOT_PROMPTED), | 345 cancel_download_confirmation_state_(NOT_PROMPTED), |
341 override_bounds_(params.initial_bounds), | 346 override_bounds_(params.initial_bounds), |
342 initial_show_state_(params.initial_show_state), | 347 initial_show_state_(params.initial_show_state), |
| 348 initial_user_has_changed_window_or_position_( |
| 349 params.is_session_restore && |
| 350 params.initial_user_has_changed_window_or_position), |
343 is_session_restore_(params.is_session_restore), | 351 is_session_restore_(params.is_session_restore), |
344 host_desktop_type_(params.host_desktop_type), | 352 host_desktop_type_(params.host_desktop_type), |
345 ALLOW_THIS_IN_INITIALIZER_LIST( | 353 ALLOW_THIS_IN_INITIALIZER_LIST( |
346 unload_controller_(new chrome::UnloadController(this))), | 354 unload_controller_(new chrome::UnloadController(this))), |
347 weak_factory_(this), | 355 weak_factory_(this), |
348 ALLOW_THIS_IN_INITIALIZER_LIST( | 356 ALLOW_THIS_IN_INITIALIZER_LIST( |
349 content_setting_bubble_model_delegate_( | 357 content_setting_bubble_model_delegate_( |
350 new BrowserContentSettingBubbleModelDelegate(this))), | 358 new BrowserContentSettingBubbleModelDelegate(this))), |
351 ALLOW_THIS_IN_INITIALIZER_LIST( | 359 ALLOW_THIS_IN_INITIALIZER_LIST( |
352 toolbar_model_delegate_( | 360 toolbar_model_delegate_( |
(...skipping 1960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2313 if (contents && !allow_js_access) { | 2321 if (contents && !allow_js_access) { |
2314 contents->web_contents()->GetController().LoadURL( | 2322 contents->web_contents()->GetController().LoadURL( |
2315 target_url, | 2323 target_url, |
2316 content::Referrer(), | 2324 content::Referrer(), |
2317 content::PAGE_TRANSITION_LINK, | 2325 content::PAGE_TRANSITION_LINK, |
2318 std::string()); // No extra headers. | 2326 std::string()); // No extra headers. |
2319 } | 2327 } |
2320 | 2328 |
2321 return contents != NULL; | 2329 return contents != NULL; |
2322 } | 2330 } |
OLD | NEW |