| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #import "chrome/browser/app_controller_mac.h" | 5 #import "chrome/browser/app_controller_mac.h" |
| 6 | 6 |
| 7 #include "app/l10n_util_mac.h" | 7 #include "app/l10n_util_mac.h" |
| 8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/mac_util.h" | 10 #include "base/mac_util.h" |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 // http://code.google.com/p/chromium/issues/detail?id=43048 . | 627 // http://code.google.com/p/chromium/issues/detail?id=43048 . |
| 628 // | 628 // |
| 629 // TODO(akalin,viettrungluu): Figure out whether this method | 629 // TODO(akalin,viettrungluu): Figure out whether this method |
| 630 // can be prevented from being called if defaultProfile is | 630 // can be prevented from being called if defaultProfile is |
| 631 // NULL. | 631 // NULL. |
| 632 if (!defaultProfile) { | 632 if (!defaultProfile) { |
| 633 LOG(WARNING) | 633 LOG(WARNING) |
| 634 << "NULL defaultProfile detected -- not doing anything"; | 634 << "NULL defaultProfile detected -- not doing anything"; |
| 635 break; | 635 break; |
| 636 } | 636 } |
| 637 enable = ProfileSyncService::IsSyncEnabled() && | 637 enable = defaultProfile->IsSyncAccessible() && |
| 638 [self keyWindowIsNotModal]; | 638 [self keyWindowIsNotModal]; |
| 639 sync_ui_util::UpdateSyncItem(item, enable, defaultProfile); | 639 sync_ui_util::UpdateSyncItem(item, enable, defaultProfile); |
| 640 break; | 640 break; |
| 641 } | 641 } |
| 642 default: | 642 default: |
| 643 enable = menuState_->IsCommandEnabled(tag) ? | 643 enable = menuState_->IsCommandEnabled(tag) ? |
| 644 [self keyWindowIsNotModal] : NO; | 644 [self keyWindowIsNotModal] : NO; |
| 645 } | 645 } |
| 646 } | 646 } |
| 647 } else if (action == @selector(terminate:)) { | 647 } else if (action == @selector(terminate:)) { |
| 648 enable = YES; | 648 enable = YES; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 menuState_->UpdateCommandEnabled(IDC_RESTORE_TAB, false); | 841 menuState_->UpdateCommandEnabled(IDC_RESTORE_TAB, false); |
| 842 menuState_->UpdateCommandEnabled(IDC_FOCUS_LOCATION, true); | 842 menuState_->UpdateCommandEnabled(IDC_FOCUS_LOCATION, true); |
| 843 menuState_->UpdateCommandEnabled(IDC_FOCUS_SEARCH, true); | 843 menuState_->UpdateCommandEnabled(IDC_FOCUS_SEARCH, true); |
| 844 menuState_->UpdateCommandEnabled(IDC_SHOW_BOOKMARK_MANAGER, true); | 844 menuState_->UpdateCommandEnabled(IDC_SHOW_BOOKMARK_MANAGER, true); |
| 845 menuState_->UpdateCommandEnabled(IDC_SHOW_HISTORY, true); | 845 menuState_->UpdateCommandEnabled(IDC_SHOW_HISTORY, true); |
| 846 menuState_->UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, true); | 846 menuState_->UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, true); |
| 847 menuState_->UpdateCommandEnabled(IDC_MANAGE_EXTENSIONS, true); | 847 menuState_->UpdateCommandEnabled(IDC_MANAGE_EXTENSIONS, true); |
| 848 menuState_->UpdateCommandEnabled(IDC_HELP_PAGE, true); | 848 menuState_->UpdateCommandEnabled(IDC_HELP_PAGE, true); |
| 849 menuState_->UpdateCommandEnabled(IDC_IMPORT_SETTINGS, true); | 849 menuState_->UpdateCommandEnabled(IDC_IMPORT_SETTINGS, true); |
| 850 menuState_->UpdateCommandEnabled(IDC_REPORT_BUG, true); | 850 menuState_->UpdateCommandEnabled(IDC_REPORT_BUG, true); |
| 851 menuState_->UpdateCommandEnabled(IDC_SYNC_BOOKMARKS, | 851 menuState_->UpdateCommandEnabled(IDC_SYNC_BOOKMARKS, true); |
| 852 ProfileSyncService::IsSyncEnabled()); | |
| 853 menuState_->UpdateCommandEnabled(IDC_TASK_MANAGER, true); | 852 menuState_->UpdateCommandEnabled(IDC_TASK_MANAGER, true); |
| 854 } | 853 } |
| 855 | 854 |
| 856 - (Profile*)defaultProfile { | 855 - (Profile*)defaultProfile { |
| 857 // TODO(jrg): Find a better way to get the "default" profile. | 856 // TODO(jrg): Find a better way to get the "default" profile. |
| 858 if (g_browser_process->profile_manager()) | 857 if (g_browser_process->profile_manager()) |
| 859 return *g_browser_process->profile_manager()->begin(); | 858 return *g_browser_process->profile_manager()->begin(); |
| 860 | 859 |
| 861 return NULL; | 860 return NULL; |
| 862 } | 861 } |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 [appController showPreferencesWindow:nil page:page profile:profile]; | 1043 [appController showPreferencesWindow:nil page:page profile:profile]; |
| 1045 } | 1044 } |
| 1046 | 1045 |
| 1047 namespace app_controller_mac { | 1046 namespace app_controller_mac { |
| 1048 | 1047 |
| 1049 bool IsOpeningNewWindow() { | 1048 bool IsOpeningNewWindow() { |
| 1050 return g_is_opening_new_window; | 1049 return g_is_opening_new_window; |
| 1051 } | 1050 } |
| 1052 | 1051 |
| 1053 } // namespace app_controller_mac | 1052 } // namespace app_controller_mac |
| OLD | NEW |