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/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" |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 int base = black ? IDR_STATUSBAR_NETWORK_BARS1_BLACK : | 368 int base = black ? IDR_STATUSBAR_NETWORK_BARS1_BLACK : |
369 IDR_STATUSBAR_NETWORK_BARS1; | 369 IDR_STATUSBAR_NETWORK_BARS1; |
370 return *ResourceBundle::GetSharedInstance().GetBitmapNamed(base + index); | 370 return *ResourceBundle::GetSharedInstance().GetBitmapNamed(base + index); |
371 } | 371 } |
372 | 372 |
373 // static | 373 // static |
374 SkBitmap NetworkMenuButton::IconForDisplay(SkBitmap icon, SkBitmap badge) { | 374 SkBitmap NetworkMenuButton::IconForDisplay(SkBitmap icon, SkBitmap badge) { |
375 // Icons are 24x24. | 375 // Icons are 24x24. |
376 static const int kIconWidth = 24; | 376 static const int kIconWidth = 24; |
377 static const int kIconHeight = 24; | 377 static const int kIconHeight = 24; |
378 // Draw the network icon 4 pixels down to center it. | 378 // Draw the network icon 3 pixels down to center it. |
379 // Because the status icon is 24x24 but the images are 24x16. | |
380 static const int kIconX = 0; | 379 static const int kIconX = 0; |
381 static const int kIconY = 4; | 380 static const int kIconY = 3; |
382 // Draw badge at (14,14). | 381 // Draw badge at (14,14). |
383 static const int kBadgeX = 14; | 382 static const int kBadgeX = 14; |
384 static const int kBadgeY = 14; | 383 static const int kBadgeY = 14; |
385 | 384 |
386 gfx::Canvas canvas(kIconWidth, kIconHeight, false); | 385 gfx::Canvas canvas(kIconWidth, kIconHeight, false); |
387 canvas.DrawBitmapInt(icon, kIconX, kIconY); | 386 canvas.DrawBitmapInt(icon, kIconX, kIconY); |
388 if (!badge.empty()) | 387 if (!badge.empty()) |
389 canvas.DrawBitmapInt(badge, kBadgeX, kBadgeY); | 388 canvas.DrawBitmapInt(badge, kBadgeX, kBadgeY); |
390 return canvas.ExtractBitmap(); | 389 return canvas.ExtractBitmap(); |
391 } | 390 } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 if (host_->ShouldOpenButtonOptions(this)) { | 511 if (host_->ShouldOpenButtonOptions(this)) { |
513 label = | 512 label = |
514 l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_OPEN_OPTIONS_DIALOG); | 513 l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_OPEN_OPTIONS_DIALOG); |
515 menu_items_.push_back(MenuItem(menus::MenuModel::TYPE_COMMAND, label, | 514 menu_items_.push_back(MenuItem(menus::MenuModel::TYPE_COMMAND, label, |
516 SkBitmap(), WifiNetwork(), CellularNetwork(), FLAG_OPTIONS)); | 515 SkBitmap(), WifiNetwork(), CellularNetwork(), FLAG_OPTIONS)); |
517 } | 516 } |
518 } | 517 } |
519 } | 518 } |
520 | 519 |
521 } // namespace chromeos | 520 } // namespace chromeos |
OLD | NEW |