Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: chrome/browser/views/toolbar_view.cc

Issue 3073002: Cleanup: Remove dead code (was only called when we had app + page menus). Ni... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/views/toolbar_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/views/toolbar_view.h" 5 #include "chrome/browser/views/toolbar_view.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "chrome/app/chrome_dll_resource.h" 9 #include "chrome/app/chrome_dll_resource.h"
10 #include "chrome/browser/browser.h" 10 #include "chrome/browser/browser.h"
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 transparent.allocPixels(); 620 transparent.allocPixels();
621 transparent.eraseARGB(0, 0, 0, 0); 621 transparent.eraseARGB(0, 0, 0, 0);
622 badge = SkBitmapOperations::CreateBlendedBitmap( 622 badge = SkBitmapOperations::CreateBlendedBitmap(
623 *dot, transparent, 1.0 - update_reminder_animation_->GetCurrentValue()); 623 *dot, transparent, 1.0 - update_reminder_animation_->GetCurrentValue());
624 if (update_reminder_animation_->GetCurrentValue() == 1.0) 624 if (update_reminder_animation_->GetCurrentValue() == 1.0)
625 has_faded_in = true; 625 has_faded_in = true;
626 } else { 626 } else {
627 // Convert animation values that start from 0.0 and incrementally go 627 // Convert animation values that start from 0.0 and incrementally go
628 // up to 1.0 into values that start in 0.0, go to 1.0 and then back 628 // up to 1.0 into values that start in 0.0, go to 1.0 and then back
629 // to 0.0 (to create a pulsing effect). 629 // to 0.0 (to create a pulsing effect).
630 double value = 1.0 - 630 double value =
631 abs(2.0 * update_reminder_animation_->GetCurrentValue() - 631 1.0 - abs(2.0 * update_reminder_animation_->GetCurrentValue() - 1.0);
632 1.0);
633 632
634 // Add the badge to it. 633 // Add the badge to it.
635 badge = SkBitmapOperations::CreateBlendedBitmap( 634 badge = SkBitmapOperations::CreateBlendedBitmap(
636 *tp->GetBitmapNamed(IDR_UPGRADE_DOT_INACTIVE), 635 *tp->GetBitmapNamed(IDR_UPGRADE_DOT_INACTIVE),
637 *tp->GetBitmapNamed(IDR_UPGRADE_DOT_ACTIVE), 636 *tp->GetBitmapNamed(IDR_UPGRADE_DOT_ACTIVE),
638 value); 637 value);
639 } 638 }
640 639
641 canvas->DrawBitmapInt(badge, kUpgradeDotOffset, 640 canvas->DrawBitmapInt(badge, kUpgradeDotOffset,
642 icon.height() - badge.height()); 641 icon.height() - badge.height());
643 642
644 return canvas->ExtractBitmap(); 643 return canvas->ExtractBitmap();
645 } 644 }
646
647 void ToolbarView::ActivateMenuButton(views::MenuButton* menu_button) {
648 #if defined(OS_WIN)
649 // On Windows, we have to explicitly clear the focus before opening
650 // the pop-up menu, then set the focus again when it closes.
651 GetFocusManager()->ClearFocus();
652 #elif defined(OS_LINUX)
653 // Under GTK, opening a pop-up menu causes the main window to lose focus.
654 // Focus is automatically returned when the menu closes.
655 //
656 // Make sure that the menu button being activated has focus, so that
657 // when the user escapes from the menu without selecting anything, focus
658 // will be returned here.
659 if (!menu_button->HasFocus()) {
660 menu_button->RequestFocus();
661 GetFocusManager()->StoreFocusedView();
662 }
663 #endif
664
665 // Tell the menu button to activate, opening its pop-up menu.
666 menu_button->Activate();
667
668 #if defined(OS_WIN)
669 SetToolbarFocus(NULL, menu_button);
670 #endif
671 }
OLDNEW
« no previous file with comments | « chrome/browser/views/toolbar_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698