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 #include "app/l10n_util.h" | 5 #include "app/l10n_util.h" |
6 #include "app/resource_bundle.h" | 6 #include "app/resource_bundle.h" |
7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
270 return; | 270 return; |
271 | 271 |
272 // Create a context menu item for Chrome. | 272 // Create a context menu item for Chrome. |
273 menus::SimpleMenuModel* menu = new menus::SimpleMenuModel(this); | 273 menus::SimpleMenuModel* menu = new menus::SimpleMenuModel(this); |
274 // Add About item | 274 // Add About item |
275 menu->AddItem(IDC_ABOUT, l10n_util::GetStringFUTF16(IDS_ABOUT, | 275 menu->AddItem(IDC_ABOUT, l10n_util::GetStringFUTF16(IDS_ABOUT, |
276 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); | 276 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); |
277 menu->AddItem(IDC_OPTIONS, GetPreferencesMenuLabel()); | 277 menu->AddItem(IDC_OPTIONS, GetPreferencesMenuLabel()); |
278 menu->AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); | 278 menu->AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); |
279 menu->AddSeparator(); | 279 menu->AddSeparator(); |
280 int application_position = 0; | 280 int position = 0; |
281 context_menu_application_offset_ = menu->GetItemCount(); | 281 context_menu_application_offset_ = menu->GetItemCount(); |
282 for (ExtensionList::const_iterator cursor = applications_.begin(); | 282 for (ExtensionList::const_iterator cursor = applications_.begin(); |
283 cursor != applications_.end(); | 283 cursor != applications_.end(); |
284 ++cursor, ++application_position) { | 284 ++cursor, ++position) { |
285 const SkBitmap* icon = applications_.GetIcon(*cursor); | 285 const SkBitmap* icon = applications_.GetIcon(*cursor); |
286 int sort_position = applications_.GetPosition(*cursor); | 286 DCHECK(position == applications_.GetPosition(*cursor)); |
287 DCHECK(sort_position == application_position); | |
288 const std::string& name = (*cursor)->name(); | 287 const std::string& name = (*cursor)->name(); |
289 menu->AddItem(sort_position, ASCIIToUTF16(name)); | 288 menu->AddItem(position, UTF8ToUTF16(name)); |
Andrew T Wilson (Slow)
2010/12/17 01:56:22
LGTM.
| |
290 if (icon) | 289 if (icon) |
291 menu->SetIcon(menu->GetItemCount() - 1, *icon); | 290 menu->SetIcon(menu->GetItemCount() - 1, *icon); |
292 } | 291 } |
293 if (applications_.size() > 0) | 292 if (applications_.size() > 0) |
294 menu->AddSeparator(); | 293 menu->AddSeparator(); |
295 menu->AddItemWithStringId(IDC_EXIT, IDS_EXIT); | 294 menu->AddItemWithStringId(IDC_EXIT, IDS_EXIT); |
296 context_menu_ = menu; | 295 context_menu_ = menu; |
297 status_icon_->SetContextMenu(menu); | 296 status_icon_->SetContextMenu(menu); |
298 } | 297 } |
299 | 298 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
372 #if !defined(OS_WIN) | 371 #if !defined(OS_WIN) |
373 // BackgroundMode is enabled by default on windows. On other platforms, it | 372 // BackgroundMode is enabled by default on windows. On other platforms, it |
374 // is enabled via about:flags. | 373 // is enabled via about:flags. |
375 background_mode_enabled = background_mode_enabled && | 374 background_mode_enabled = background_mode_enabled && |
376 command_line->HasSwitch(switches::kEnableBackgroundMode); | 375 command_line->HasSwitch(switches::kEnableBackgroundMode); |
377 #endif | 376 #endif |
378 | 377 |
379 return background_mode_enabled; | 378 return background_mode_enabled; |
380 } | 379 } |
381 | 380 |
OLD | NEW |