| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 28 matching lines...) Expand all Loading... |
| 39 #include "chrome/common/profiling.h" | 39 #include "chrome/common/profiling.h" |
| 40 #include "content/public/browser/host_zoom_map.h" | 40 #include "content/public/browser/host_zoom_map.h" |
| 41 #include "content/public/browser/notification_service.h" | 41 #include "content/public/browser/notification_service.h" |
| 42 #include "content/public/browser/notification_source.h" | 42 #include "content/public/browser/notification_source.h" |
| 43 #include "content/public/browser/notification_types.h" | 43 #include "content/public/browser/notification_types.h" |
| 44 #include "content/public/browser/user_metrics.h" | 44 #include "content/public/browser/user_metrics.h" |
| 45 #include "content/public/browser/web_contents.h" | 45 #include "content/public/browser/web_contents.h" |
| 46 #include "grit/chromium_strings.h" | 46 #include "grit/chromium_strings.h" |
| 47 #include "grit/generated_resources.h" | 47 #include "grit/generated_resources.h" |
| 48 #include "grit/theme_resources.h" | 48 #include "grit/theme_resources.h" |
| 49 #include "third_party/skia/include/core/SkBitmap.h" | |
| 50 #include "ui/base/l10n/l10n_util.h" | 49 #include "ui/base/l10n/l10n_util.h" |
| 51 #include "ui/base/layout.h" | 50 #include "ui/base/layout.h" |
| 52 #include "ui/base/models/button_menu_item_model.h" | 51 #include "ui/base/models/button_menu_item_model.h" |
| 53 #include "ui/base/resource/resource_bundle.h" | 52 #include "ui/base/resource/resource_bundle.h" |
| 54 #include "ui/gfx/image/image.h" | 53 #include "ui/gfx/image/image.h" |
| 54 #include "ui/gfx/image/image_skia.h" |
| 55 | 55 |
| 56 #if defined(TOOLKIT_GTK) | 56 #if defined(TOOLKIT_GTK) |
| 57 #include <gtk/gtk.h> | 57 #include <gtk/gtk.h> |
| 58 #include "chrome/browser/ui/gtk/gtk_util.h" | 58 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 59 #endif | 59 #endif |
| 60 | 60 |
| 61 #if defined(OS_WIN) | 61 #if defined(OS_WIN) |
| 62 #include "chrome/browser/enumerate_modules_model_win.h" | 62 #include "chrome/browser/enumerate_modules_model_win.h" |
| 63 #endif | 63 #endif |
| 64 | 64 |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 } | 487 } |
| 488 | 488 |
| 489 if (browser_defaults::kShowUpgradeMenuItem) | 489 if (browser_defaults::kShowUpgradeMenuItem) |
| 490 AddItem(IDC_UPGRADE_DIALOG, l10n_util::GetStringUTF16(IDS_UPDATE_NOW)); | 490 AddItem(IDC_UPGRADE_DIALOG, l10n_util::GetStringUTF16(IDS_UPDATE_NOW)); |
| 491 AddItem(IDC_VIEW_INCOMPATIBILITIES, l10n_util::GetStringUTF16( | 491 AddItem(IDC_VIEW_INCOMPATIBILITIES, l10n_util::GetStringUTF16( |
| 492 IDS_VIEW_INCOMPATIBILITIES)); | 492 IDS_VIEW_INCOMPATIBILITIES)); |
| 493 | 493 |
| 494 #if defined(OS_WIN) | 494 #if defined(OS_WIN) |
| 495 SetIcon(GetIndexOfCommandId(IDC_VIEW_INCOMPATIBILITIES), | 495 SetIcon(GetIndexOfCommandId(IDC_VIEW_INCOMPATIBILITIES), |
| 496 *ui::ResourceBundle::GetSharedInstance(). | 496 *ui::ResourceBundle::GetSharedInstance(). |
| 497 GetBitmapNamed(IDR_CONFLICT_MENU)); | 497 GetImageSkiaNamed(IDR_CONFLICT_MENU)); |
| 498 #endif | 498 #endif |
| 499 | 499 |
| 500 if (!is_touch_menu) { | 500 if (!is_touch_menu) { |
| 501 AddItemWithStringId(IDC_HELP_PAGE, IDS_HELP_PAGE); | 501 AddItemWithStringId(IDC_HELP_PAGE, IDS_HELP_PAGE); |
| 502 | 502 |
| 503 if (browser_defaults::kShowHelpMenuItemIcon) { | 503 if (browser_defaults::kShowHelpMenuItemIcon) { |
| 504 ui::ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 504 ui::ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 505 SetIcon(GetIndexOfCommandId(IDC_HELP_PAGE), | 505 SetIcon(GetIndexOfCommandId(IDC_HELP_PAGE), |
| 506 *rb.GetBitmapNamed(IDR_HELP_MENU)); | 506 *rb.GetImageSkiaNamed(IDR_HELP_MENU)); |
| 507 } | 507 } |
| 508 } | 508 } |
| 509 | 509 |
| 510 if (browser_defaults::kShowFeedbackMenuItem) | 510 if (browser_defaults::kShowFeedbackMenuItem) |
| 511 AddItemWithStringId(IDC_FEEDBACK, IDS_FEEDBACK); | 511 AddItemWithStringId(IDC_FEEDBACK, IDS_FEEDBACK); |
| 512 | 512 |
| 513 AddGlobalErrorMenuItems(); | 513 AddGlobalErrorMenuItems(); |
| 514 | 514 |
| 515 if (browser_defaults::kShowExitMenuItem) { | 515 if (browser_defaults::kShowExitMenuItem) { |
| 516 AddSeparator(); | 516 AddSeparator(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 528 GlobalErrorServiceFactory::GetForProfile(browser_->profile())->errors(); | 528 GlobalErrorServiceFactory::GetForProfile(browser_->profile())->errors(); |
| 529 for (GlobalErrorService::GlobalErrorList::const_iterator | 529 for (GlobalErrorService::GlobalErrorList::const_iterator |
| 530 it = errors.begin(); it != errors.end(); ++it) { | 530 it = errors.begin(); it != errors.end(); ++it) { |
| 531 GlobalError* error = *it; | 531 GlobalError* error = *it; |
| 532 if (error->HasMenuItem()) { | 532 if (error->HasMenuItem()) { |
| 533 AddItem(error->MenuItemCommandID(), error->MenuItemLabel()); | 533 AddItem(error->MenuItemCommandID(), error->MenuItemLabel()); |
| 534 int icon_id = error->MenuItemIconResourceID(); | 534 int icon_id = error->MenuItemIconResourceID(); |
| 535 if (icon_id) { | 535 if (icon_id) { |
| 536 gfx::Image& image = rb.GetImageNamed(icon_id); | 536 gfx::Image& image = rb.GetImageNamed(icon_id); |
| 537 SetIcon(GetIndexOfCommandId(error->MenuItemCommandID()), | 537 SetIcon(GetIndexOfCommandId(error->MenuItemCommandID()), |
| 538 *image.ToSkBitmap()); | 538 *image.ToImageSkia()); |
| 539 } | 539 } |
| 540 } | 540 } |
| 541 } | 541 } |
| 542 } | 542 } |
| 543 | 543 |
| 544 void WrenchMenuModel::CreateCutCopyPasteMenu(bool append_final_separator) { | 544 void WrenchMenuModel::CreateCutCopyPasteMenu(bool append_final_separator) { |
| 545 AddSeparator(); | 545 AddSeparator(); |
| 546 | 546 |
| 547 #if defined(OS_POSIX) && !defined(TOOLKIT_VIEWS) | 547 #if defined(OS_POSIX) && !defined(TOOLKIT_VIEWS) |
| 548 // WARNING: Mac does not use the ButtonMenuItemModel, but instead defines the | 548 // WARNING: Mac does not use the ButtonMenuItemModel, but instead defines the |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 zoom_label_ = l10n_util::GetStringFUTF16( | 607 zoom_label_ = l10n_util::GetStringFUTF16( |
| 608 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); | 608 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); |
| 609 } | 609 } |
| 610 | 610 |
| 611 string16 WrenchMenuModel::GetSyncMenuLabel() const { | 611 string16 WrenchMenuModel::GetSyncMenuLabel() const { |
| 612 Profile* profile = browser_->profile()->GetOriginalProfile(); | 612 Profile* profile = browser_->profile()->GetOriginalProfile(); |
| 613 return sync_ui_util::GetSyncMenuLabel( | 613 return sync_ui_util::GetSyncMenuLabel( |
| 614 ProfileSyncServiceFactory::GetForProfile(profile), | 614 ProfileSyncServiceFactory::GetForProfile(profile), |
| 615 *SigninManagerFactory::GetForProfile(profile)); | 615 *SigninManagerFactory::GetForProfile(profile)); |
| 616 } | 616 } |
| OLD | NEW |