| 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 "chrome/browser/chromeos/status/network_menu_button.h" | 5 #include "chrome/browser/chromeos/status/network_menu_button.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "chrome/browser/chromeos/cros/cros_library.h" | 12 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 13 #include "chrome/browser/chromeos/options/network_config_view.h" | 13 #include "chrome/browser/chromeos/options/network_config_view.h" |
| 14 #include "chrome/browser/chromeos/status/status_area_host.h" | 14 #include "chrome/browser/chromeos/status/status_area_host.h" |
| 15 #include "gfx/canvas.h" | 15 #include "gfx/canvas_skia.h" |
| 16 #include "gfx/skbitmap_operations.h" | 16 #include "gfx/skbitmap_operations.h" |
| 17 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
| 18 #include "grit/theme_resources.h" | 18 #include "grit/theme_resources.h" |
| 19 #include "views/widget/widget.h" | 19 #include "views/widget/widget.h" |
| 20 #include "views/window/window.h" | 20 #include "views/window/window.h" |
| 21 | 21 |
| 22 namespace chromeos { | 22 namespace chromeos { |
| 23 | 23 |
| 24 //////////////////////////////////////////////////////////////////////////////// | 24 //////////////////////////////////////////////////////////////////////////////// |
| 25 // NetworkMenuButton | 25 // NetworkMenuButton |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 // Icons are 24x24. | 380 // Icons are 24x24. |
| 381 static const int kIconWidth = 24; | 381 static const int kIconWidth = 24; |
| 382 static const int kIconHeight = 24; | 382 static const int kIconHeight = 24; |
| 383 // Draw the network icon 3 pixels down to center it. | 383 // Draw the network icon 3 pixels down to center it. |
| 384 static const int kIconX = 0; | 384 static const int kIconX = 0; |
| 385 static const int kIconY = 3; | 385 static const int kIconY = 3; |
| 386 // Draw badge at (14,14). | 386 // Draw badge at (14,14). |
| 387 static const int kBadgeX = 14; | 387 static const int kBadgeX = 14; |
| 388 static const int kBadgeY = 14; | 388 static const int kBadgeY = 14; |
| 389 | 389 |
| 390 gfx::Canvas canvas(kIconWidth, kIconHeight, false); | 390 gfx::CanvasSkia canvas(kIconWidth, kIconHeight, false); |
| 391 canvas.DrawBitmapInt(icon, kIconX, kIconY); | 391 canvas.DrawBitmapInt(icon, kIconX, kIconY); |
| 392 if (!badge.empty()) | 392 if (!badge.empty()) |
| 393 canvas.DrawBitmapInt(badge, kBadgeX, kBadgeY); | 393 canvas.DrawBitmapInt(badge, kBadgeX, kBadgeY); |
| 394 return canvas.ExtractBitmap(); | 394 return canvas.ExtractBitmap(); |
| 395 } | 395 } |
| 396 | 396 |
| 397 //////////////////////////////////////////////////////////////////////////////// | 397 //////////////////////////////////////////////////////////////////////////////// |
| 398 // NetworkMenuButton, views::ViewMenuDelegate implementation: | 398 // NetworkMenuButton, views::ViewMenuDelegate implementation: |
| 399 | 399 |
| 400 void NetworkMenuButton::RunMenu(views::View* source, const gfx::Point& pt) { | 400 void NetworkMenuButton::RunMenu(views::View* source, const gfx::Point& pt) { |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 if (host_->ShouldOpenButtonOptions(this)) { | 516 if (host_->ShouldOpenButtonOptions(this)) { |
| 517 label = | 517 label = |
| 518 l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_OPEN_OPTIONS_DIALOG); | 518 l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_OPEN_OPTIONS_DIALOG); |
| 519 menu_items_.push_back(MenuItem(menus::MenuModel::TYPE_COMMAND, label, | 519 menu_items_.push_back(MenuItem(menus::MenuModel::TYPE_COMMAND, label, |
| 520 SkBitmap(), WifiNetwork(), CellularNetwork(), FLAG_OPTIONS)); | 520 SkBitmap(), WifiNetwork(), CellularNetwork(), FLAG_OPTIONS)); |
| 521 } | 521 } |
| 522 } | 522 } |
| 523 } | 523 } |
| 524 | 524 |
| 525 } // namespace chromeos | 525 } // namespace chromeos |
| OLD | NEW |