OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/sync/sync_ui_util_mac.h" | 5 #include "chrome/browser/sync/sync_ui_util_mac.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "app/l10n_util_mac.h" | 9 #include "app/l10n_util_mac.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
(...skipping 21 matching lines...) Expand all Loading... |
33 DCHECK_NE(syncItemIndex, -1); | 33 DCHECK_NE(syncItemIndex, -1); |
34 if ((syncItemIndex + 1) < [menu numberOfItems]) { | 34 if ((syncItemIndex + 1) < [menu numberOfItems]) { |
35 NSMenuItem* menuItem = [menu itemAtIndex:(syncItemIndex + 1)]; | 35 NSMenuItem* menuItem = [menu itemAtIndex:(syncItemIndex + 1)]; |
36 if ([menuItem isSeparatorItem]) { | 36 if ([menuItem isSeparatorItem]) { |
37 followingSeparator = menuItem; | 37 followingSeparator = menuItem; |
38 } | 38 } |
39 } | 39 } |
40 } | 40 } |
41 | 41 |
42 // TODO(akalin): consolidate this code with the equivalent Windows code in | 42 // TODO(akalin): consolidate this code with the equivalent Windows code in |
43 // chrome/browser/views/toolbar_view.cc. | 43 // chrome/browser/ui/views/toolbar_view.cc. |
44 int titleId; | 44 int titleId; |
45 switch (status) { | 45 switch (status) { |
46 case sync_ui_util::SYNCED: | 46 case sync_ui_util::SYNCED: |
47 titleId = IDS_SYNC_MENU_SYNCED_LABEL; | 47 titleId = IDS_SYNC_MENU_SYNCED_LABEL; |
48 break; | 48 break; |
49 case sync_ui_util::SYNC_ERROR: | 49 case sync_ui_util::SYNC_ERROR: |
50 titleId = IDS_SYNC_MENU_SYNC_ERROR_LABEL; | 50 titleId = IDS_SYNC_MENU_SYNC_ERROR_LABEL; |
51 break; | 51 break; |
52 case sync_ui_util::PRE_SYNCED: | 52 case sync_ui_util::PRE_SYNCED: |
53 titleId = IDS_SYNC_START_SYNC_BUTTON_LABEL; | 53 titleId = IDS_SYNC_START_SYNC_BUTTON_LABEL; |
54 break; | 54 break; |
55 default: | 55 default: |
56 NOTREACHED(); | 56 NOTREACHED(); |
57 // Needed to prevent release-mode warnings. | 57 // Needed to prevent release-mode warnings. |
58 titleId = IDS_SYNC_START_SYNC_BUTTON_LABEL; | 58 titleId = IDS_SYNC_START_SYNC_BUTTON_LABEL; |
59 break; | 59 break; |
60 } | 60 } |
61 NSString* title = l10n_util::GetNSStringWithFixup(titleId); | 61 NSString* title = l10n_util::GetNSStringWithFixup(titleId); |
62 [syncMenuItem setTitle:title]; | 62 [syncMenuItem setTitle:title]; |
63 | 63 |
64 // If we don't have a sync service, hide any sync-related menu | 64 // If we don't have a sync service, hide any sync-related menu |
65 // items. However, sync_menu_item is enabled/disabled outside of this | 65 // items. However, sync_menu_item is enabled/disabled outside of this |
66 // function so we don't touch it here, and separators are always disabled. | 66 // function so we don't touch it here, and separators are always disabled. |
67 [syncMenuItem setHidden:!syncEnabled]; | 67 [syncMenuItem setHidden:!syncEnabled]; |
68 [followingSeparator setHidden:!syncEnabled]; | 68 [followingSeparator setHidden:!syncEnabled]; |
69 } | 69 } |
70 | 70 |
71 } // namespace sync_ui_util | 71 } // namespace sync_ui_util |
OLD | NEW |