OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/browser.h" | 5 #include "chrome/browser/browser.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/idle_timer.h" | 8 #include "base/idle_timer.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 Browser::OpenEmptyWindow(profile_->GetOriginalProfile()); | 630 Browser::OpenEmptyWindow(profile_->GetOriginalProfile()); |
631 } | 631 } |
632 | 632 |
633 void Browser::NewIncognitoWindow() { | 633 void Browser::NewIncognitoWindow() { |
634 UserMetrics::RecordAction(L"NewIncognitoWindow", profile_); | 634 UserMetrics::RecordAction(L"NewIncognitoWindow", profile_); |
635 Browser::OpenEmptyWindow(profile_->GetOffTheRecordProfile()); | 635 Browser::OpenEmptyWindow(profile_->GetOffTheRecordProfile()); |
636 } | 636 } |
637 | 637 |
638 void Browser::NewProfileWindowByIndex(int index) { | 638 void Browser::NewProfileWindowByIndex(int index) { |
639 #if defined(OS_WIN) | 639 #if defined(OS_WIN) |
| 640 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 641 if (!command_line.HasSwitch(switches::kEnableUserDataDirProfiles)) |
| 642 return; |
640 UserMetrics::RecordAction(L"NewProfileWindowByIndex", profile_); | 643 UserMetrics::RecordAction(L"NewProfileWindowByIndex", profile_); |
641 UserDataManager::Get()->LaunchChromeForProfile(index); | 644 UserDataManager::Get()->LaunchChromeForProfile(index); |
642 #endif | 645 #endif |
643 } | 646 } |
644 | 647 |
645 void Browser::CloseWindow() { | 648 void Browser::CloseWindow() { |
646 UserMetrics::RecordAction(L"CloseWindow", profile_); | 649 UserMetrics::RecordAction(L"CloseWindow", profile_); |
647 window_->Close(); | 650 window_->Close(); |
648 } | 651 } |
649 | 652 |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 UserMetrics::RecordAction(L"TaskManager", profile_); | 939 UserMetrics::RecordAction(L"TaskManager", profile_); |
937 TaskManager::Open(); | 940 TaskManager::Open(); |
938 } | 941 } |
939 | 942 |
940 void Browser::OpenSelectProfileDialog() { | 943 void Browser::OpenSelectProfileDialog() { |
941 UserMetrics::RecordAction(L"SelectProfile", profile_); | 944 UserMetrics::RecordAction(L"SelectProfile", profile_); |
942 window_->ShowSelectProfileDialog(); | 945 window_->ShowSelectProfileDialog(); |
943 } | 946 } |
944 | 947 |
945 void Browser::OpenNewProfileDialog() { | 948 void Browser::OpenNewProfileDialog() { |
| 949 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 950 if (!command_line.HasSwitch(switches::kEnableUserDataDirProfiles)) |
| 951 return; |
946 UserMetrics::RecordAction(L"CreateProfile", profile_); | 952 UserMetrics::RecordAction(L"CreateProfile", profile_); |
947 window_->ShowNewProfileDialog(); | 953 window_->ShowNewProfileDialog(); |
948 } | 954 } |
949 | 955 |
950 void Browser::OpenBugReportDialog() { | 956 void Browser::OpenBugReportDialog() { |
951 UserMetrics::RecordAction(L"ReportBug", profile_); | 957 UserMetrics::RecordAction(L"ReportBug", profile_); |
952 window_->ShowReportBugDialog(); | 958 window_->ShowReportBugDialog(); |
953 } | 959 } |
954 | 960 |
955 void Browser::ToggleBookmarkBar() { | 961 void Browser::ToggleBookmarkBar() { |
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2442 | 2448 |
2443 // We need to register the window position pref. | 2449 // We need to register the window position pref. |
2444 std::wstring window_pref(prefs::kBrowserWindowPlacement); | 2450 std::wstring window_pref(prefs::kBrowserWindowPlacement); |
2445 window_pref.append(L"_"); | 2451 window_pref.append(L"_"); |
2446 window_pref.append(app_name); | 2452 window_pref.append(app_name); |
2447 PrefService* prefs = g_browser_process->local_state(); | 2453 PrefService* prefs = g_browser_process->local_state(); |
2448 DCHECK(prefs); | 2454 DCHECK(prefs); |
2449 | 2455 |
2450 prefs->RegisterDictionaryPref(window_pref.c_str()); | 2456 prefs->RegisterDictionaryPref(window_pref.c_str()); |
2451 } | 2457 } |
OLD | NEW |