| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/views/toolbar_view.h" | 5 #include "chrome/browser/views/toolbar_view.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "app/drag_drop_types.h" | 9 #include "app/drag_drop_types.h" |
| 10 #include "app/gfx/canvas.h" | 10 #include "app/gfx/canvas.h" |
| 11 #include "app/l10n_util.h" | 11 #include "app/l10n_util.h" |
| 12 #include "app/os_exchange_data.h" | 12 #include "app/os_exchange_data.h" |
| 13 #include "app/resource_bundle.h" | 13 #include "app/resource_bundle.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/keyboard_codes.h" | 15 #include "base/keyboard_codes.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 18 #include "chrome/app/chrome_dll_resource.h" | 18 #include "chrome/app/chrome_dll_resource.h" |
| 19 #include "chrome/browser/back_forward_menu_model_views.h" | 19 #include "chrome/browser/back_forward_menu_model_views.h" |
| 20 #include "chrome/browser/bookmarks/bookmark_model.h" | 20 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 21 #include "chrome/browser/browser.h" | 21 #include "chrome/browser/browser.h" |
| 22 #include "chrome/browser/browser_process.h" | 22 #include "chrome/browser/browser_process.h" |
| 23 #include "chrome/browser/browser_theme_provider.h" |
| 23 #include "chrome/browser/browser_window.h" | 24 #include "chrome/browser/browser_window.h" |
| 24 #include "chrome/browser/character_encoding.h" | 25 #include "chrome/browser/character_encoding.h" |
| 25 #include "chrome/browser/encoding_menu_controller.h" | 26 #include "chrome/browser/encoding_menu_controller.h" |
| 26 #include "chrome/browser/metrics/user_metrics.h" | 27 #include "chrome/browser/metrics/user_metrics.h" |
| 27 #include "chrome/browser/profile.h" | 28 #include "chrome/browser/profile.h" |
| 29 #include "chrome/browser/sync/sync_status_ui_helper.h" |
| 28 #include "chrome/browser/tab_contents/navigation_controller.h" | 30 #include "chrome/browser/tab_contents/navigation_controller.h" |
| 29 #include "chrome/browser/tab_contents/navigation_entry.h" | 31 #include "chrome/browser/tab_contents/navigation_entry.h" |
| 30 #include "chrome/browser/browser_theme_provider.h" | |
| 31 #include "chrome/browser/user_data_manager.h" | 32 #include "chrome/browser/user_data_manager.h" |
| 32 #include "chrome/browser/views/bookmark_menu_button.h" | 33 #include "chrome/browser/views/bookmark_menu_button.h" |
| 33 #include "chrome/browser/views/browser_actions_container.h" | 34 #include "chrome/browser/views/browser_actions_container.h" |
| 34 #include "chrome/browser/views/event_utils.h" | 35 #include "chrome/browser/views/event_utils.h" |
| 35 #include "chrome/browser/views/go_button.h" | 36 #include "chrome/browser/views/go_button.h" |
| 36 #include "chrome/browser/views/location_bar_view.h" | 37 #include "chrome/browser/views/location_bar_view.h" |
| 37 #include "chrome/browser/views/toolbar_star_toggle.h" | 38 #include "chrome/browser/views/toolbar_star_toggle.h" |
| 38 #include "chrome/browser/view_ids.h" | 39 #include "chrome/browser/view_ids.h" |
| 39 #include "chrome/common/chrome_constants.h" | 40 #include "chrome/common/chrome_constants.h" |
| 40 #include "chrome/common/chrome_switches.h" | 41 #include "chrome/common/chrome_switches.h" |
| (...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1126 ExtensionsService* extensions_service = | 1127 ExtensionsService* extensions_service = |
| 1127 browser_->profile()->GetExtensionsService(); | 1128 browser_->profile()->GetExtensionsService(); |
| 1128 if (extensions_service && extensions_service->extensions_enabled()) { | 1129 if (extensions_service && extensions_service->extensions_enabled()) { |
| 1129 app_menu_contents_->AddItemWithStringId(IDC_MANAGE_EXTENSIONS, | 1130 app_menu_contents_->AddItemWithStringId(IDC_MANAGE_EXTENSIONS, |
| 1130 IDS_SHOW_EXTENSIONS); | 1131 IDS_SHOW_EXTENSIONS); |
| 1131 } | 1132 } |
| 1132 | 1133 |
| 1133 app_menu_contents_->AddSeparator(); | 1134 app_menu_contents_->AddSeparator(); |
| 1134 #ifdef CHROME_PERSONALIZATION | 1135 #ifdef CHROME_PERSONALIZATION |
| 1135 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableSync)) { | 1136 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableSync)) { |
| 1136 app_menu_contents_->AddItem(IDC_SYNC_BOOKMARKS, | 1137 std::wstring label; |
| 1137 l10n_util::GetString(IDS_SYNC_MY_BOOKMARKS_LABEL) + L"..."); | 1138 std::wstring link; |
| 1139 // TODO(timsteele): Need a ui helper method to just get the type without |
| 1140 // needing labels. |
| 1141 SyncStatusUIHelper::MessageType type = SyncStatusUIHelper::GetLabels( |
| 1142 browser_->profile()->GetProfileSyncService(), &label, &link); |
| 1143 label = type == SyncStatusUIHelper::SYNCED ? |
| 1144 l10n_util::GetString(IDS_SYNC_MENU_BOOKMARKS_SYNCED_LABEL) : |
| 1145 type == SyncStatusUIHelper::SYNC_ERROR ? |
| 1146 l10n_util::GetString(IDS_SYNC_MENU_BOOKMARK_SYNC_ERROR_LABEL) : |
| 1147 l10n_util::GetString(IDS_SYNC_START_SYNC_BUTTON_LABEL); |
| 1148 app_menu_contents_->AddItem(IDC_SYNC_BOOKMARKS, label); |
| 1138 app_menu_contents_->AddSeparator(); | 1149 app_menu_contents_->AddSeparator(); |
| 1139 } | 1150 } |
| 1140 #endif | 1151 #endif |
| 1141 app_menu_contents_->AddItem(IDC_OPTIONS, | 1152 app_menu_contents_->AddItem(IDC_OPTIONS, |
| 1142 l10n_util::GetStringFUTF16( | 1153 l10n_util::GetStringFUTF16( |
| 1143 IDS_OPTIONS, | 1154 IDS_OPTIONS, |
| 1144 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); | 1155 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); |
| 1145 app_menu_contents_->AddItem(IDC_ABOUT, | 1156 app_menu_contents_->AddItem(IDC_ABOUT, |
| 1146 l10n_util::GetStringFUTF16( | 1157 l10n_util::GetStringFUTF16( |
| 1147 IDS_ABOUT, | 1158 IDS_ABOUT, |
| 1148 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); | 1159 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); |
| 1149 app_menu_contents_->AddItemWithStringId(IDC_HELP_PAGE, IDS_HELP_PAGE); | 1160 app_menu_contents_->AddItemWithStringId(IDC_HELP_PAGE, IDS_HELP_PAGE); |
| 1150 app_menu_contents_->AddSeparator(); | 1161 app_menu_contents_->AddSeparator(); |
| 1151 app_menu_contents_->AddItemWithStringId(IDC_EXIT, IDS_EXIT); | 1162 app_menu_contents_->AddItemWithStringId(IDC_EXIT, IDS_EXIT); |
| 1152 | 1163 |
| 1153 app_menu_menu_.reset(new views::Menu2(app_menu_contents_.get())); | 1164 app_menu_menu_.reset(new views::Menu2(app_menu_contents_.get())); |
| 1154 } | 1165 } |
| OLD | NEW |