| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 2136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2147 command_updater_.UpdateCommandEnabled(IDC_SELECT_LAST_TAB, normal_window); | 2147 command_updater_.UpdateCommandEnabled(IDC_SELECT_LAST_TAB, normal_window); |
| 2148 command_updater_.UpdateCommandEnabled(IDC_RESTORE_TAB, | 2148 command_updater_.UpdateCommandEnabled(IDC_RESTORE_TAB, |
| 2149 normal_window && !profile_->IsOffTheRecord()); | 2149 normal_window && !profile_->IsOffTheRecord()); |
| 2150 | 2150 |
| 2151 // Show various bits of UI | 2151 // Show various bits of UI |
| 2152 #if defined(OS_WIN) | 2152 #if defined(OS_WIN) |
| 2153 command_updater_.UpdateCommandEnabled(IDC_DEBUGGER, | 2153 command_updater_.UpdateCommandEnabled(IDC_DEBUGGER, |
| 2154 // The debugger doesn't work in single process mode. | 2154 // The debugger doesn't work in single process mode. |
| 2155 normal_window && !RenderProcessHost::run_renderer_in_process()); | 2155 normal_window && !RenderProcessHost::run_renderer_in_process()); |
| 2156 #endif | 2156 #endif |
| 2157 command_updater_.UpdateCommandEnabled(IDC_CLEAR_BROWSING_DATA, |
| 2158 normal_window); |
| 2157 } | 2159 } |
| 2158 | 2160 |
| 2159 // Initialize other commands whose state changes based on fullscreen mode. | 2161 // Initialize other commands whose state changes based on fullscreen mode. |
| 2160 UpdateCommandsForFullscreenMode(false); | 2162 UpdateCommandsForFullscreenMode(false); |
| 2161 } | 2163 } |
| 2162 | 2164 |
| 2163 void Browser::UpdateCommandsForTabState() { | 2165 void Browser::UpdateCommandsForTabState() { |
| 2164 TabContents* current_tab = GetSelectedTabContents(); | 2166 TabContents* current_tab = GetSelectedTabContents(); |
| 2165 if (!current_tab) // May be NULL during tab restore. | 2167 if (!current_tab) // May be NULL during tab restore. |
| 2166 return; | 2168 return; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2230 // Focus various bits of UI | 2232 // Focus various bits of UI |
| 2231 command_updater_.UpdateCommandEnabled(IDC_FOCUS_TOOLBAR, show_main_ui); | 2233 command_updater_.UpdateCommandEnabled(IDC_FOCUS_TOOLBAR, show_main_ui); |
| 2232 command_updater_.UpdateCommandEnabled(IDC_FOCUS_LOCATION, show_main_ui); | 2234 command_updater_.UpdateCommandEnabled(IDC_FOCUS_LOCATION, show_main_ui); |
| 2233 command_updater_.UpdateCommandEnabled(IDC_FOCUS_SEARCH, show_main_ui); | 2235 command_updater_.UpdateCommandEnabled(IDC_FOCUS_SEARCH, show_main_ui); |
| 2234 | 2236 |
| 2235 // Show various bits of UI | 2237 // Show various bits of UI |
| 2236 command_updater_.UpdateCommandEnabled(IDC_DEVELOPER_MENU, show_main_ui); | 2238 command_updater_.UpdateCommandEnabled(IDC_DEVELOPER_MENU, show_main_ui); |
| 2237 command_updater_.UpdateCommandEnabled(IDC_NEW_PROFILE, show_main_ui); | 2239 command_updater_.UpdateCommandEnabled(IDC_NEW_PROFILE, show_main_ui); |
| 2238 command_updater_.UpdateCommandEnabled(IDC_REPORT_BUG, show_main_ui); | 2240 command_updater_.UpdateCommandEnabled(IDC_REPORT_BUG, show_main_ui); |
| 2239 command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_BAR, show_main_ui); | 2241 command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_BAR, show_main_ui); |
| 2240 command_updater_.UpdateCommandEnabled(IDC_CLEAR_BROWSING_DATA, show_main_ui); | |
| 2241 command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, show_main_ui); | 2242 command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, show_main_ui); |
| 2242 command_updater_.UpdateCommandEnabled(IDC_OPTIONS, show_main_ui); | 2243 command_updater_.UpdateCommandEnabled(IDC_OPTIONS, show_main_ui); |
| 2243 command_updater_.UpdateCommandEnabled(IDC_EDIT_SEARCH_ENGINES, show_main_ui); | 2244 command_updater_.UpdateCommandEnabled(IDC_EDIT_SEARCH_ENGINES, show_main_ui); |
| 2244 command_updater_.UpdateCommandEnabled(IDC_VIEW_PASSWORDS, show_main_ui); | 2245 command_updater_.UpdateCommandEnabled(IDC_VIEW_PASSWORDS, show_main_ui); |
| 2245 command_updater_.UpdateCommandEnabled(IDC_ABOUT, show_main_ui); | 2246 command_updater_.UpdateCommandEnabled(IDC_ABOUT, show_main_ui); |
| 2246 } | 2247 } |
| 2247 | 2248 |
| 2248 void Browser::UpdateStopGoState(bool is_loading, bool force) { | 2249 void Browser::UpdateStopGoState(bool is_loading, bool force) { |
| 2249 window_->UpdateStopGoState(is_loading, force); | 2250 window_->UpdateStopGoState(is_loading, force); |
| 2250 command_updater_.UpdateCommandEnabled(IDC_GO, !is_loading); | 2251 command_updater_.UpdateCommandEnabled(IDC_GO, !is_loading); |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2644 | 2645 |
| 2645 // We need to register the window position pref. | 2646 // We need to register the window position pref. |
| 2646 std::wstring window_pref(prefs::kBrowserWindowPlacement); | 2647 std::wstring window_pref(prefs::kBrowserWindowPlacement); |
| 2647 window_pref.append(L"_"); | 2648 window_pref.append(L"_"); |
| 2648 window_pref.append(app_name); | 2649 window_pref.append(app_name); |
| 2649 PrefService* prefs = g_browser_process->local_state(); | 2650 PrefService* prefs = g_browser_process->local_state(); |
| 2650 DCHECK(prefs); | 2651 DCHECK(prefs); |
| 2651 | 2652 |
| 2652 prefs->RegisterDictionaryPref(window_pref.c_str()); | 2653 prefs->RegisterDictionaryPref(window_pref.c_str()); |
| 2653 } | 2654 } |
| OLD | NEW |