OLD | NEW |
---|---|
1 // Copyright (c) 2011 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/ui/toolbar/wrench_menu_model.h" | 5 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
238 return command_id != IDC_ZOOM_MINUS && command_id != IDC_ZOOM_PLUS; | 238 return command_id != IDC_ZOOM_MINUS && command_id != IDC_ZOOM_PLUS; |
239 } | 239 } |
240 | 240 |
241 bool WrenchMenuModel::IsItemForCommandIdDynamic(int command_id) const { | 241 bool WrenchMenuModel::IsItemForCommandIdDynamic(int command_id) const { |
242 return command_id == IDC_ZOOM_PERCENT_DISPLAY || | 242 return command_id == IDC_ZOOM_PERCENT_DISPLAY || |
243 #if defined(OS_MACOSX) | 243 #if defined(OS_MACOSX) |
244 command_id == IDC_FULLSCREEN || | 244 command_id == IDC_FULLSCREEN || |
245 #endif | 245 #endif |
246 command_id == IDC_SYNC_BOOKMARKS || | 246 command_id == IDC_SYNC_BOOKMARKS || |
247 command_id == IDC_VIEW_BACKGROUND_PAGES || | 247 command_id == IDC_VIEW_BACKGROUND_PAGES || |
248 command_id == IDC_UPGRADE_DIALOG; | 248 command_id == IDC_UPGRADE_DIALOG || |
249 command_id == IDC_SHOW_SYNC_SETUP; | |
249 } | 250 } |
250 | 251 |
251 string16 WrenchMenuModel::GetLabelForCommandId(int command_id) const { | 252 string16 WrenchMenuModel::GetLabelForCommandId(int command_id) const { |
252 switch (command_id) { | 253 switch (command_id) { |
253 case IDC_SYNC_BOOKMARKS: | 254 case IDC_SYNC_BOOKMARKS: |
254 return GetSyncMenuLabel(); | 255 return GetSyncMenuLabel(); |
255 case IDC_ZOOM_PERCENT_DISPLAY: | 256 case IDC_ZOOM_PERCENT_DISPLAY: |
256 return zoom_label_; | 257 return zoom_label_; |
257 #if defined(OS_MACOSX) | 258 #if defined(OS_MACOSX) |
258 case IDC_FULLSCREEN: { | 259 case IDC_FULLSCREEN: { |
(...skipping 13 matching lines...) Expand all Loading... | |
272 case IDC_UPGRADE_DIALOG: { | 273 case IDC_UPGRADE_DIALOG: { |
273 #if defined(OS_CHROMEOS) | 274 #if defined(OS_CHROMEOS) |
274 const string16 product_name = | 275 const string16 product_name = |
275 l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME); | 276 l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME); |
276 #else | 277 #else |
277 const string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); | 278 const string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); |
278 #endif | 279 #endif |
279 | 280 |
280 return l10n_util::GetStringFUTF16(IDS_UPDATE_NOW, product_name); | 281 return l10n_util::GetStringFUTF16(IDS_UPDATE_NOW, product_name); |
281 } | 282 } |
283 case IDC_SHOW_SYNC_SETUP: { | |
284 std::string username = browser_->GetProfile()->GetPrefs()->GetString( | |
285 prefs::kGoogleServicesUsername); | |
286 const string16 short_product_name = | |
Peter Kasting
2011/08/10 00:38:43
Nit: Why use const on one string but not the other
sail
2011/08/10 00:55:33
Done. Removed the const.
| |
287 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME); | |
288 if (username.empty()) { | |
289 return l10n_util::GetStringFUTF16(IDS_SHOW_SYNC_SETUP, | |
290 short_product_name); | |
291 } else { | |
Peter Kasting
2011/08/10 00:38:43
Nit: No else after return.
sail
2011/08/10 00:55:33
Done.
| |
292 return l10n_util::GetStringFUTF16(IDS_SHOW_SYNC_SETUP_USERNAME, | |
293 short_product_name, | |
294 UTF8ToUTF16(username)); | |
295 } | |
296 } | |
282 default: | 297 default: |
283 NOTREACHED(); | 298 NOTREACHED(); |
284 return string16(); | 299 return string16(); |
285 } | 300 } |
286 } | 301 } |
287 | 302 |
288 bool WrenchMenuModel::GetIconForCommandId(int command_id, | 303 bool WrenchMenuModel::GetIconForCommandId(int command_id, |
289 SkBitmap* icon) const { | 304 SkBitmap* icon) const { |
290 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 305 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
291 switch (command_id) { | 306 switch (command_id) { |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
555 &enable_increment, &enable_decrement); | 570 &enable_increment, &enable_decrement); |
556 } | 571 } |
557 zoom_label_ = l10n_util::GetStringFUTF16( | 572 zoom_label_ = l10n_util::GetStringFUTF16( |
558 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); | 573 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); |
559 } | 574 } |
560 | 575 |
561 string16 WrenchMenuModel::GetSyncMenuLabel() const { | 576 string16 WrenchMenuModel::GetSyncMenuLabel() const { |
562 return sync_ui_util::GetSyncMenuLabel( | 577 return sync_ui_util::GetSyncMenuLabel( |
563 browser_->profile()->GetOriginalProfile()->GetProfileSyncService()); | 578 browser_->profile()->GetOriginalProfile()->GetProfileSyncService()); |
564 } | 579 } |
OLD | NEW |