| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_commands.h" | 5 #include "chrome/browser/ui/browser_commands.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 content::RecordAction(UserMetricsAction("NewWindow")); | 285 content::RecordAction(UserMetricsAction("NewWindow")); |
| 286 SessionService* session_service = | 286 SessionService* session_service = |
| 287 SessionServiceFactory::GetForProfile(profile->GetOriginalProfile()); | 287 SessionServiceFactory::GetForProfile(profile->GetOriginalProfile()); |
| 288 if (!session_service || | 288 if (!session_service || |
| 289 !session_service->RestoreIfNecessary(std::vector<GURL>())) { | 289 !session_service->RestoreIfNecessary(std::vector<GURL>())) { |
| 290 OpenEmptyWindow(profile->GetOriginalProfile(), desktop_type); | 290 OpenEmptyWindow(profile->GetOriginalProfile(), desktop_type); |
| 291 } | 291 } |
| 292 } | 292 } |
| 293 } | 293 } |
| 294 | 294 |
| 295 // TODO(gab): This method is deprecated and will be removed shortly. Please use | |
| 296 // the new version of the NewEmptyWindow call. | |
| 297 void NewEmptyWindowDeprecated(Profile* profile) { | |
| 298 NewEmptyWindow(profile, HOST_DESKTOP_TYPE_NATIVE); | |
| 299 } | |
| 300 | |
| 301 Browser* OpenEmptyWindow(Profile* profile, HostDesktopType desktop_type) { | 295 Browser* OpenEmptyWindow(Profile* profile, HostDesktopType desktop_type) { |
| 302 // TODO(scottmg): http://crbug.com/128578 | 296 // TODO(scottmg): http://crbug.com/128578 |
| 303 // This is necessary because WebContentsViewAura doesn't have enough context | 297 // This is necessary because WebContentsViewAura doesn't have enough context |
| 304 // to get the right StackingClient (and therefore parent window) otherwise. | 298 // to get the right StackingClient (and therefore parent window) otherwise. |
| 305 ScopedForceDesktopType force_desktop_type(desktop_type); | 299 ScopedForceDesktopType force_desktop_type(desktop_type); |
| 306 Browser* browser = new Browser( | 300 Browser* browser = new Browser( |
| 307 Browser::CreateParams(Browser::TYPE_TABBED, profile, desktop_type)); | 301 Browser::CreateParams(Browser::TYPE_TABBED, profile, desktop_type)); |
| 308 AddBlankTabAt(browser, -1, true); | 302 AddBlankTabAt(browser, -1, true); |
| 309 browser->window()->Show(); | 303 browser->window()->Show(); |
| 310 return browser; | 304 return browser; |
| (...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 Browser::CreateParams::CreateForApp( | 1091 Browser::CreateParams::CreateForApp( |
| 1098 Browser::TYPE_POPUP, app_name, gfx::Rect(), browser->profile())); | 1092 Browser::TYPE_POPUP, app_name, gfx::Rect(), browser->profile())); |
| 1099 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1093 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
| 1100 | 1094 |
| 1101 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1095 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
| 1102 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1096 contents->GetRenderViewHost()->SyncRendererPrefs(); |
| 1103 app_browser->window()->Show(); | 1097 app_browser->window()->Show(); |
| 1104 } | 1098 } |
| 1105 | 1099 |
| 1106 } // namespace chrome | 1100 } // namespace chrome |
| OLD | NEW |