| 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/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 incognito = false; | 269 incognito = false; |
| 270 } | 270 } |
| 271 } else { | 271 } else { |
| 272 if (browser_defaults::kAlwaysOpenIncognitoWindow && | 272 if (browser_defaults::kAlwaysOpenIncognitoWindow && |
| 273 IncognitoModePrefs::ShouldLaunchIncognito( | 273 IncognitoModePrefs::ShouldLaunchIncognito( |
| 274 *CommandLine::ForCurrentProcess(), prefs)) { | 274 *CommandLine::ForCurrentProcess(), prefs)) { |
| 275 incognito = true; | 275 incognito = true; |
| 276 } | 276 } |
| 277 } | 277 } |
| 278 | 278 |
| 279 if (prefs->GetBoolean(prefs::kInManagedMode)) { |
| 280 content::RecordAction( |
| 281 UserMetricsAction("ManagedMode_NewManagedUserWindow")); |
| 282 } |
| 283 |
| 279 if (incognito) { | 284 if (incognito) { |
| 280 content::RecordAction(UserMetricsAction("NewIncognitoWindow")); | 285 content::RecordAction(UserMetricsAction("NewIncognitoWindow")); |
| 281 OpenEmptyWindow(profile->GetOffTheRecordProfile(), desktop_type); | 286 OpenEmptyWindow(profile->GetOffTheRecordProfile(), desktop_type); |
| 282 } else { | 287 } else { |
| 283 content::RecordAction(UserMetricsAction("NewWindow")); | 288 content::RecordAction(UserMetricsAction("NewWindow")); |
| 284 SessionService* session_service = | 289 SessionService* session_service = |
| 285 SessionServiceFactory::GetForProfile(profile->GetOriginalProfile()); | 290 SessionServiceFactory::GetForProfile(profile->GetOriginalProfile()); |
| 286 if (!session_service || | 291 if (!session_service || |
| 287 !session_service->RestoreIfNecessary(std::vector<GURL>())) { | 292 !session_service->RestoreIfNecessary(std::vector<GURL>())) { |
| 288 OpenEmptyWindow(profile->GetOriginalProfile(), desktop_type); | 293 OpenEmptyWindow(profile->GetOriginalProfile(), desktop_type); |
| (...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1087 Browser::CreateParams::CreateForApp( | 1092 Browser::CreateParams::CreateForApp( |
| 1088 Browser::TYPE_POPUP, app_name, gfx::Rect(), browser->profile())); | 1093 Browser::TYPE_POPUP, app_name, gfx::Rect(), browser->profile())); |
| 1089 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1094 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
| 1090 | 1095 |
| 1091 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1096 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
| 1092 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1097 contents->GetRenderViewHost()->SyncRendererPrefs(); |
| 1093 app_browser->window()->Show(); | 1098 app_browser->window()->Show(); |
| 1094 } | 1099 } |
| 1095 | 1100 |
| 1096 } // namespace chrome | 1101 } // namespace chrome |
| OLD | NEW |