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

Side by Side Diff: chrome/browser/ui/toolbar/toolbar_actions_bar.cc

Issue 795663003: [Mac Extensions Toolbar] Make the container's animationEndFrame always valid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/toolbar_actions_bar.h" 5 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "chrome/browser/extensions/extension_action_manager.h" 8 #include "chrome/browser/extensions/extension_action_manager.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/sessions/session_tab_helper.h" 10 #include "chrome/browser/sessions/session_tab_helper.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 54 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
55 IDR_BROWSER_ACTION); 55 IDR_BROWSER_ACTION);
56 icon_height = skia->height(); 56 icon_height = skia->height();
57 icon_width = skia->width(); 57 icon_width = skia->width();
58 } 58 }
59 return type == WIDTH ? icon_width : icon_height; 59 return type == WIDTH ? icon_width : icon_height;
60 } 60 }
61 61
62 } // namespace 62 } // namespace
63 63
64 // static
65 bool ToolbarActionsBar::disable_animations_for_testing_ = false;
66
64 ToolbarActionsBar::PlatformSettings::PlatformSettings(bool in_overflow_mode) 67 ToolbarActionsBar::PlatformSettings::PlatformSettings(bool in_overflow_mode)
65 : left_padding(in_overflow_mode ? kOverflowLeftPadding : kLeftPadding), 68 : left_padding(in_overflow_mode ? kOverflowLeftPadding : kLeftPadding),
66 right_padding(in_overflow_mode ? kOverflowRightPadding : kRightPadding), 69 right_padding(in_overflow_mode ? kOverflowRightPadding : kRightPadding),
67 item_spacing(kItemSpacing), 70 item_spacing(kItemSpacing),
68 icons_per_overflow_menu_row(1), 71 icons_per_overflow_menu_row(1),
69 chevron_enabled(!extensions::FeatureSwitch::extension_action_redesign()-> 72 chevron_enabled(!extensions::FeatureSwitch::extension_action_redesign()->
70 IsEnabled()) { 73 IsEnabled()) {
71 } 74 }
72 75
73 ToolbarActionsBar::ToolbarActionsBar(ToolbarActionsBarDelegate* delegate, 76 ToolbarActionsBar::ToolbarActionsBar(ToolbarActionsBarDelegate* delegate,
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 CreateActions(); 521 CreateActions();
519 // Resize the delegate. We suppress the chevron so that we don't risk showing 522 // Resize the delegate. We suppress the chevron so that we don't risk showing
520 // it only for the duration of the animation. 523 // it only for the duration of the animation.
521 ResizeDelegate(gfx::Tween::LINEAR, true); 524 ResizeDelegate(gfx::Tween::LINEAR, true);
522 } 525 }
523 526
524 void ToolbarActionsBar::OnToolbarModelInitialized() { 527 void ToolbarActionsBar::OnToolbarModelInitialized() {
525 // We shouldn't have any actions before the model is initialized. 528 // We shouldn't have any actions before the model is initialized.
526 DCHECK(toolbar_actions_.empty()); 529 DCHECK(toolbar_actions_.empty());
527 CreateActions(); 530 CreateActions();
531 ResizeDelegate(gfx::Tween::EASE_OUT, false);
528 } 532 }
529 533
530 Browser* ToolbarActionsBar::GetBrowser() { 534 Browser* ToolbarActionsBar::GetBrowser() {
531 return browser_; 535 return browser_;
532 } 536 }
533 537
534 void ToolbarActionsBar::TabInsertedAt(content::WebContents* web_contents, 538 void ToolbarActionsBar::TabInsertedAt(content::WebContents* web_contents,
535 int index, 539 int index,
536 bool foreground) { 540 bool foreground) {
537 if (foreground) 541 if (foreground)
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 for (ToolbarActionViewController* action : toolbar_actions_) { 613 for (ToolbarActionViewController* action : toolbar_actions_) {
610 if (action->GetId() == id) 614 if (action->GetId() == id)
611 return action; 615 return action;
612 } 616 }
613 return nullptr; 617 return nullptr;
614 } 618 }
615 619
616 content::WebContents* ToolbarActionsBar::GetCurrentWebContents() { 620 content::WebContents* ToolbarActionsBar::GetCurrentWebContents() {
617 return browser_->tab_strip_model()->GetActiveWebContents(); 621 return browser_->tab_strip_model()->GetActiveWebContents();
618 } 622 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/toolbar_actions_bar.h ('k') | chrome/browser/ui/views/toolbar/browser_action_test_util_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698