| 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 "app/animation.h" | 7 #include "app/animation.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/keyboard_codes.h" | 10 #include "base/keyboard_codes.h" |
| (...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 command_updater_.UpdateCommandEnabled(IDC_FOCUS_LOCATION, show_main_ui); | 647 command_updater_.UpdateCommandEnabled(IDC_FOCUS_LOCATION, show_main_ui); |
| 648 command_updater_.UpdateCommandEnabled(IDC_FOCUS_SEARCH, show_main_ui); | 648 command_updater_.UpdateCommandEnabled(IDC_FOCUS_SEARCH, show_main_ui); |
| 649 | 649 |
| 650 // Show various bits of UI | 650 // Show various bits of UI |
| 651 command_updater_.UpdateCommandEnabled(IDC_DEVELOPER_MENU, show_main_ui); | 651 command_updater_.UpdateCommandEnabled(IDC_DEVELOPER_MENU, show_main_ui); |
| 652 command_updater_.UpdateCommandEnabled(IDC_NEW_PROFILE, show_main_ui); | 652 command_updater_.UpdateCommandEnabled(IDC_NEW_PROFILE, show_main_ui); |
| 653 command_updater_.UpdateCommandEnabled(IDC_REPORT_BUG, show_main_ui); | 653 command_updater_.UpdateCommandEnabled(IDC_REPORT_BUG, show_main_ui); |
| 654 command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_BAR, show_main_ui); | 654 command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_BAR, show_main_ui); |
| 655 command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, show_main_ui); | 655 command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, show_main_ui); |
| 656 command_updater_.UpdateCommandEnabled( | 656 command_updater_.UpdateCommandEnabled( |
| 657 IDC_SYNC_BOOKMARKS, | 657 IDC_SYNC_BOOKMARKS, show_main_ui && |
| 658 show_main_ui && profile_->GetProfileSyncService() != NULL); | 658 profile_->GetOriginalProfile()->GetProfileSyncService() != NULL); |
| 659 command_updater_.UpdateCommandEnabled(IDC_OPTIONS, show_main_ui); | 659 command_updater_.UpdateCommandEnabled(IDC_OPTIONS, show_main_ui); |
| 660 command_updater_.UpdateCommandEnabled(IDC_EDIT_SEARCH_ENGINES, show_main_ui); | 660 command_updater_.UpdateCommandEnabled(IDC_EDIT_SEARCH_ENGINES, show_main_ui); |
| 661 command_updater_.UpdateCommandEnabled(IDC_VIEW_PASSWORDS, show_main_ui); | 661 command_updater_.UpdateCommandEnabled(IDC_VIEW_PASSWORDS, show_main_ui); |
| 662 command_updater_.UpdateCommandEnabled(IDC_ABOUT, show_main_ui); | 662 command_updater_.UpdateCommandEnabled(IDC_ABOUT, show_main_ui); |
| 663 command_updater_.UpdateCommandEnabled(IDC_SHOW_APP_MENU, show_main_ui); | 663 command_updater_.UpdateCommandEnabled(IDC_SHOW_APP_MENU, show_main_ui); |
| 664 command_updater_.UpdateCommandEnabled(IDC_SHOW_PAGE_MENU, show_main_ui); | 664 command_updater_.UpdateCommandEnabled(IDC_SHOW_PAGE_MENU, show_main_ui); |
| 665 } | 665 } |
| 666 | 666 |
| 667 /////////////////////////////////////////////////////////////////////////////// | 667 /////////////////////////////////////////////////////////////////////////////// |
| 668 // Browser, Assorted browser commands: | 668 // Browser, Assorted browser commands: |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1194 void Browser::OpenPasswordManager() { | 1194 void Browser::OpenPasswordManager() { |
| 1195 window_->ShowPasswordManager(); | 1195 window_->ShowPasswordManager(); |
| 1196 } | 1196 } |
| 1197 | 1197 |
| 1198 void Browser::OpenImportSettingsDialog() { | 1198 void Browser::OpenImportSettingsDialog() { |
| 1199 UserMetrics::RecordAction(L"Import_ShowDlg", profile_); | 1199 UserMetrics::RecordAction(L"Import_ShowDlg", profile_); |
| 1200 window_->ShowImportDialog(); | 1200 window_->ShowImportDialog(); |
| 1201 } | 1201 } |
| 1202 | 1202 |
| 1203 void Browser::OpenSyncMyBookmarksDialog() { | 1203 void Browser::OpenSyncMyBookmarksDialog() { |
| 1204 ProfileSyncService* service = profile_->GetProfileSyncService(); | 1204 ProfileSyncService* service = |
| 1205 // TODO(timsteele): Incognito has no sync service for the time being, | 1205 profile_->GetOriginalProfile()->GetProfileSyncService(); |
| 1206 // so protect against this case. | 1206 // It shouldn't be possible to be in this function without a service. |
| 1207 DCHECK(service); |
| 1207 if (!service) | 1208 if (!service) |
| 1208 return; | 1209 return; |
| 1210 |
| 1209 if (service->HasSyncSetupCompleted()) { | 1211 if (service->HasSyncSetupCompleted()) { |
| 1210 ShowOptionsWindow(OPTIONS_PAGE_CONTENT, OPTIONS_GROUP_NONE, profile_); | 1212 ShowOptionsWindow(OPTIONS_PAGE_CONTENT, OPTIONS_GROUP_NONE, profile_); |
| 1211 } else { | 1213 } else { |
| 1212 service->EnableForUser(); | 1214 service->EnableForUser(); |
| 1213 ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_WRENCH); | 1215 ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_WRENCH); |
| 1214 } | 1216 } |
| 1215 } | 1217 } |
| 1216 | 1218 |
| 1217 void Browser::OpenAboutChromeDialog() { | 1219 void Browser::OpenAboutChromeDialog() { |
| 1218 UserMetrics::RecordAction(L"AboutChrome", profile_); | 1220 UserMetrics::RecordAction(L"AboutChrome", profile_); |
| (...skipping 1750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2969 /////////////////////////////////////////////////////////////////////////////// | 2971 /////////////////////////////////////////////////////////////////////////////// |
| 2970 // BrowserToolbarModel (private): | 2972 // BrowserToolbarModel (private): |
| 2971 | 2973 |
| 2972 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { | 2974 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { |
| 2973 // This |current_tab| can be NULL during the initialization of the | 2975 // This |current_tab| can be NULL during the initialization of the |
| 2974 // toolbar during window creation (i.e. before any tabs have been added | 2976 // toolbar during window creation (i.e. before any tabs have been added |
| 2975 // to the window). | 2977 // to the window). |
| 2976 TabContents* current_tab = browser_->GetSelectedTabContents(); | 2978 TabContents* current_tab = browser_->GetSelectedTabContents(); |
| 2977 return current_tab ? ¤t_tab->controller() : NULL; | 2979 return current_tab ? ¤t_tab->controller() : NULL; |
| 2978 } | 2980 } |
| OLD | NEW |