| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/views/toolbar/browser_actions_container.h" | 5 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "chrome/browser/extensions/tab_helper.h" | 9 #include "chrome/browser/extensions/tab_helper.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 BrowserActionsContainer::DropPosition::DropPosition( | 58 BrowserActionsContainer::DropPosition::DropPosition( |
| 59 size_t row, size_t icon_in_row) | 59 size_t row, size_t icon_in_row) |
| 60 : row(row), icon_in_row(icon_in_row) { | 60 : row(row), icon_in_row(icon_in_row) { |
| 61 } | 61 } |
| 62 | 62 |
| 63 //////////////////////////////////////////////////////////////////////////////// | 63 //////////////////////////////////////////////////////////////////////////////// |
| 64 // BrowserActionsContainer | 64 // BrowserActionsContainer |
| 65 | 65 |
| 66 // static | |
| 67 bool BrowserActionsContainer::disable_animations_during_testing_ = false; | |
| 68 | |
| 69 BrowserActionsContainer::BrowserActionsContainer( | 66 BrowserActionsContainer::BrowserActionsContainer( |
| 70 Browser* browser, | 67 Browser* browser, |
| 71 BrowserActionsContainer* main_container) | 68 BrowserActionsContainer* main_container) |
| 72 : toolbar_actions_bar_(new ToolbarActionsBar(this, | 69 : toolbar_actions_bar_(new ToolbarActionsBar(this, |
| 73 browser, | 70 browser, |
| 74 main_container != nullptr)), | 71 main_container != nullptr)), |
| 75 browser_(browser), | 72 browser_(browser), |
| 76 main_container_(main_container), | 73 main_container_(main_container), |
| 77 popup_owner_(NULL), | 74 popup_owner_(NULL), |
| 78 container_width_(0), | 75 container_width_(0), |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 } else { | 278 } else { |
| 282 Layout(); | 279 Layout(); |
| 283 SchedulePaint(); | 280 SchedulePaint(); |
| 284 } | 281 } |
| 285 } | 282 } |
| 286 | 283 |
| 287 void BrowserActionsContainer::ResizeAndAnimate( | 284 void BrowserActionsContainer::ResizeAndAnimate( |
| 288 gfx::Tween::Type tween_type, | 285 gfx::Tween::Type tween_type, |
| 289 int target_width, | 286 int target_width, |
| 290 bool suppress_chevron) { | 287 bool suppress_chevron) { |
| 291 if (resize_animation_ && | 288 if (resize_animation_ && !toolbar_actions_bar_->suppress_animation()) { |
| 292 !disable_animations_during_testing_ && | |
| 293 !toolbar_actions_bar_->suppress_animation()) { | |
| 294 // Animate! We have to set the animation_target_size_ after calling Reset(), | 289 // Animate! We have to set the animation_target_size_ after calling Reset(), |
| 295 // because that could end up calling AnimationEnded which clears the value. | 290 // because that could end up calling AnimationEnded which clears the value. |
| 296 resize_animation_->Reset(); | 291 resize_animation_->Reset(); |
| 297 suppress_chevron_ = suppress_chevron; | 292 suppress_chevron_ = suppress_chevron; |
| 298 resize_animation_->SetTweenType(tween_type); | 293 resize_animation_->SetTweenType(tween_type); |
| 299 animation_target_size_ = target_width; | 294 animation_target_size_ = target_width; |
| 300 resize_animation_->Show(); | 295 resize_animation_->Show(); |
| 301 } else { | 296 } else { |
| 302 animation_target_size_ = target_width; | 297 animation_target_size_ = target_width; |
| 303 AnimationEnded(resize_animation_.get()); | 298 AnimationEnded(resize_animation_.get()); |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 | 750 |
| 756 ui::ThemeProvider* tp = GetThemeProvider(); | 751 ui::ThemeProvider* tp = GetThemeProvider(); |
| 757 if (tp && chevron_) { | 752 if (tp && chevron_) { |
| 758 chevron_->SetImage(views::Button::STATE_NORMAL, | 753 chevron_->SetImage(views::Button::STATE_NORMAL, |
| 759 *tp->GetImageSkiaNamed(IDR_BROWSER_ACTIONS_OVERFLOW)); | 754 *tp->GetImageSkiaNamed(IDR_BROWSER_ACTIONS_OVERFLOW)); |
| 760 } | 755 } |
| 761 | 756 |
| 762 const int kImages[] = IMAGE_GRID(IDR_DEVELOPER_MODE_HIGHLIGHT); | 757 const int kImages[] = IMAGE_GRID(IDR_DEVELOPER_MODE_HIGHLIGHT); |
| 763 highlight_painter_.reset(views::Painter::CreateImageGridPainter(kImages)); | 758 highlight_painter_.reset(views::Painter::CreateImageGridPainter(kImages)); |
| 764 } | 759 } |
| OLD | NEW |