| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 // static | 67 // static |
| 68 bool BrowserActionsContainer::disable_animations_during_testing_ = false; | 68 bool BrowserActionsContainer::disable_animations_during_testing_ = false; |
| 69 | 69 |
| 70 BrowserActionsContainer::BrowserActionsContainer( | 70 BrowserActionsContainer::BrowserActionsContainer( |
| 71 Browser* browser, | 71 Browser* browser, |
| 72 BrowserActionsContainer* main_container) | 72 BrowserActionsContainer* main_container) |
| 73 : toolbar_actions_bar_(new ToolbarActionsBar(this, | 73 : toolbar_actions_bar_(new ToolbarActionsBar(this, |
| 74 browser, | 74 browser, |
| 75 main_container != nullptr)), | 75 main_container != nullptr)), |
| 76 initialized_(false), | |
| 77 browser_(browser), | 76 browser_(browser), |
| 78 main_container_(main_container), | 77 main_container_(main_container), |
| 79 popup_owner_(NULL), | 78 popup_owner_(NULL), |
| 80 container_width_(0), | 79 container_width_(0), |
| 81 resize_area_(NULL), | 80 resize_area_(NULL), |
| 82 chevron_(NULL), | 81 chevron_(NULL), |
| 83 suppress_chevron_(false), | 82 suppress_chevron_(false), |
| 84 resize_amount_(0), | 83 resize_amount_(0), |
| 85 animation_target_size_(0) { | 84 animation_target_size_(0) { |
| 86 set_id(VIEW_ID_BROWSER_ACTION_TOOLBAR); | 85 set_id(VIEW_ID_BROWSER_ACTION_TOOLBAR); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // All views should be removed as part of ToolbarActionsBar::DeleteActions(). | 118 // All views should be removed as part of ToolbarActionsBar::DeleteActions(). |
| 120 DCHECK(toolbar_action_views_.empty()); | 119 DCHECK(toolbar_action_views_.empty()); |
| 121 } | 120 } |
| 122 | 121 |
| 123 void BrowserActionsContainer::Init() { | 122 void BrowserActionsContainer::Init() { |
| 124 LoadImages(); | 123 LoadImages(); |
| 125 | 124 |
| 126 // We wait to set the container width until now so that the chevron images | 125 // We wait to set the container width until now so that the chevron images |
| 127 // will be loaded. The width calculation needs to know the chevron size. | 126 // will be loaded. The width calculation needs to know the chevron size. |
| 128 container_width_ = toolbar_actions_bar_->GetPreferredSize().width(); | 127 container_width_ = toolbar_actions_bar_->GetPreferredSize().width(); |
| 129 | |
| 130 initialized_ = true; | |
| 131 } | 128 } |
| 132 | 129 |
| 133 const std::string& BrowserActionsContainer::GetIdAt(size_t index) { | 130 const std::string& BrowserActionsContainer::GetIdAt(size_t index) { |
| 134 return toolbar_action_views_[index]->view_controller()->GetId(); | 131 return toolbar_action_views_[index]->view_controller()->GetId(); |
| 135 } | 132 } |
| 136 | 133 |
| 137 ToolbarActionView* BrowserActionsContainer::GetViewForId( | 134 ToolbarActionView* BrowserActionsContainer::GetViewForId( |
| 138 const std::string& id) { | 135 const std::string& id) { |
| 139 for (ToolbarActionView* view : toolbar_action_views_) { | 136 for (ToolbarActionView* view : toolbar_action_views_) { |
| 140 if (view->view_controller()->GetId() == id) | 137 if (view->view_controller()->GetId() == id) |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 | 738 |
| 742 ui::ThemeProvider* tp = GetThemeProvider(); | 739 ui::ThemeProvider* tp = GetThemeProvider(); |
| 743 if (tp && chevron_) { | 740 if (tp && chevron_) { |
| 744 chevron_->SetImage(views::Button::STATE_NORMAL, | 741 chevron_->SetImage(views::Button::STATE_NORMAL, |
| 745 *tp->GetImageSkiaNamed(IDR_BROWSER_ACTIONS_OVERFLOW)); | 742 *tp->GetImageSkiaNamed(IDR_BROWSER_ACTIONS_OVERFLOW)); |
| 746 } | 743 } |
| 747 | 744 |
| 748 const int kImages[] = IMAGE_GRID(IDR_DEVELOPER_MODE_HIGHLIGHT); | 745 const int kImages[] = IMAGE_GRID(IDR_DEVELOPER_MODE_HIGHLIGHT); |
| 749 highlight_painter_.reset(views::Painter::CreateImageGridPainter(kImages)); | 746 highlight_painter_.reset(views::Painter::CreateImageGridPainter(kImages)); |
| 750 } | 747 } |
| OLD | NEW |