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/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 | 314 |
315 void NewEmptyWindow(Profile* profile, HostDesktopType desktop_type) { | 315 void NewEmptyWindow(Profile* profile, HostDesktopType desktop_type) { |
316 bool incognito = profile->IsOffTheRecord(); | 316 bool incognito = profile->IsOffTheRecord(); |
317 PrefService* prefs = profile->GetPrefs(); | 317 PrefService* prefs = profile->GetPrefs(); |
318 if (incognito) { | 318 if (incognito) { |
319 if (IncognitoModePrefs::GetAvailability(prefs) == | 319 if (IncognitoModePrefs::GetAvailability(prefs) == |
320 IncognitoModePrefs::DISABLED) { | 320 IncognitoModePrefs::DISABLED) { |
321 incognito = false; | 321 incognito = false; |
322 } | 322 } |
323 } else if (profile->IsGuestSession() || | 323 } else if (profile->IsGuestSession() || |
324 (browser_defaults::kAlwaysOpenIncognitoWindow && | 324 (browser_defaults::kAlwaysOpenIncognitoWindow && |
325 IncognitoModePrefs::ShouldLaunchIncognito( | 325 IncognitoModePrefs::ShouldLaunchIncognito( |
326 *CommandLine::ForCurrentProcess(), prefs))) { | 326 *base::CommandLine::ForCurrentProcess(), prefs))) { |
327 incognito = true; | 327 incognito = true; |
328 } | 328 } |
329 | 329 |
330 if (incognito) { | 330 if (incognito) { |
331 content::RecordAction(UserMetricsAction("NewIncognitoWindow")); | 331 content::RecordAction(UserMetricsAction("NewIncognitoWindow")); |
332 OpenEmptyWindow(profile->GetOffTheRecordProfile(), desktop_type); | 332 OpenEmptyWindow(profile->GetOffTheRecordProfile(), desktop_type); |
333 } else { | 333 } else { |
334 content::RecordAction(UserMetricsAction("NewWindow")); | 334 content::RecordAction(UserMetricsAction("NewWindow")); |
335 SessionService* session_service = | 335 SessionService* session_service = |
336 SessionServiceFactory::GetForProfileForSessionRestore( | 336 SessionServiceFactory::GetForProfileForSessionRestore( |
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 browser->host_desktop_type())); | 1276 browser->host_desktop_type())); |
1277 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1277 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
1278 | 1278 |
1279 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1279 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
1280 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1280 contents->GetRenderViewHost()->SyncRendererPrefs(); |
1281 app_browser->window()->Show(); | 1281 app_browser->window()->Show(); |
1282 } | 1282 } |
1283 #endif // defined(ENABLE_EXTENSIONS) | 1283 #endif // defined(ENABLE_EXTENSIONS) |
1284 | 1284 |
1285 } // namespace chrome | 1285 } // namespace chrome |
OLD | NEW |