| 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/toolbar_view.h" | 5 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/i18n/number_formatting.h" | 10 #include "base/i18n/number_formatting.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 158 |
| 159 ToolbarView::~ToolbarView() { | 159 ToolbarView::~ToolbarView() { |
| 160 // NOTE: Don't remove the command observers here. This object gets destroyed | 160 // NOTE: Don't remove the command observers here. This object gets destroyed |
| 161 // after the Browser (which owns the CommandUpdater), so the CommandUpdater is | 161 // after the Browser (which owns the CommandUpdater), so the CommandUpdater is |
| 162 // already gone. | 162 // already gone. |
| 163 } | 163 } |
| 164 | 164 |
| 165 void ToolbarView::Init() { | 165 void ToolbarView::Init() { |
| 166 GetWidget()->AddObserver(this); | 166 GetWidget()->AddObserver(this); |
| 167 | 167 |
| 168 back_ = new BackButton(this, new BackForwardMenuModel( | 168 back_ = new BackButton( |
| 169 browser_, BackForwardMenuModel::BACKWARD_MENU)); | 169 browser_->profile(), this, |
| 170 new BackForwardMenuModel(browser_, BackForwardMenuModel::BACKWARD_MENU)); |
| 170 back_->set_triggerable_event_flags( | 171 back_->set_triggerable_event_flags( |
| 171 ui::EF_LEFT_MOUSE_BUTTON | ui::EF_MIDDLE_MOUSE_BUTTON); | 172 ui::EF_LEFT_MOUSE_BUTTON | ui::EF_MIDDLE_MOUSE_BUTTON); |
| 172 back_->set_tag(IDC_BACK); | 173 back_->set_tag(IDC_BACK); |
| 173 back_->SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_BACK)); | 174 back_->SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_BACK)); |
| 174 back_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_BACK)); | 175 back_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_BACK)); |
| 175 back_->set_id(VIEW_ID_BACK_BUTTON); | 176 back_->set_id(VIEW_ID_BACK_BUTTON); |
| 176 back_->Init(); | 177 back_->Init(); |
| 177 | 178 |
| 178 forward_ = new ToolbarButton(this, new BackForwardMenuModel( | 179 forward_ = new ToolbarButton( |
| 179 browser_, BackForwardMenuModel::FORWARD_MENU)); | 180 browser_->profile(), this, |
| 181 new BackForwardMenuModel(browser_, BackForwardMenuModel::FORWARD_MENU)); |
| 180 forward_->set_triggerable_event_flags( | 182 forward_->set_triggerable_event_flags( |
| 181 ui::EF_LEFT_MOUSE_BUTTON | ui::EF_MIDDLE_MOUSE_BUTTON); | 183 ui::EF_LEFT_MOUSE_BUTTON | ui::EF_MIDDLE_MOUSE_BUTTON); |
| 182 forward_->set_tag(IDC_FORWARD); | 184 forward_->set_tag(IDC_FORWARD); |
| 183 forward_->SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_FORWARD)); | 185 forward_->SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_FORWARD)); |
| 184 forward_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_FORWARD)); | 186 forward_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_FORWARD)); |
| 185 forward_->set_id(VIEW_ID_FORWARD_BUTTON); | 187 forward_->set_id(VIEW_ID_FORWARD_BUTTON); |
| 186 forward_->Init(); | 188 forward_->Init(); |
| 187 | 189 |
| 188 location_bar_ = new LocationBarView( | 190 location_bar_ = new LocationBarView( |
| 189 browser_, browser_->profile(), | 191 browser_, browser_->profile(), |
| 190 browser_->command_controller()->command_updater(), this, | 192 browser_->command_controller()->command_updater(), this, |
| 191 display_mode_ == DISPLAYMODE_LOCATION); | 193 display_mode_ == DISPLAYMODE_LOCATION); |
| 192 | 194 |
| 193 reload_ = new ReloadButton(browser_->command_controller()->command_updater()); | 195 reload_ = new ReloadButton(browser_->profile(), |
| 196 browser_->command_controller()->command_updater()); |
| 194 reload_->set_triggerable_event_flags( | 197 reload_->set_triggerable_event_flags( |
| 195 ui::EF_LEFT_MOUSE_BUTTON | ui::EF_MIDDLE_MOUSE_BUTTON); | 198 ui::EF_LEFT_MOUSE_BUTTON | ui::EF_MIDDLE_MOUSE_BUTTON); |
| 196 reload_->set_tag(IDC_RELOAD); | 199 reload_->set_tag(IDC_RELOAD); |
| 197 reload_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_RELOAD)); | 200 reload_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_RELOAD)); |
| 198 reload_->set_id(VIEW_ID_RELOAD_BUTTON); | 201 reload_->set_id(VIEW_ID_RELOAD_BUTTON); |
| 199 reload_->Init(); | 202 reload_->Init(); |
| 200 | 203 |
| 201 home_ = new HomeButton(this, browser_); | 204 home_ = new HomeButton(this, browser_); |
| 202 home_->set_triggerable_event_flags( | 205 home_->set_triggerable_event_flags( |
| 203 ui::EF_LEFT_MOUSE_BUTTON | ui::EF_MIDDLE_MOUSE_BUTTON); | 206 ui::EF_LEFT_MOUSE_BUTTON | ui::EF_MIDDLE_MOUSE_BUTTON); |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 void ToolbarView::OnShowHomeButtonChanged() { | 824 void ToolbarView::OnShowHomeButtonChanged() { |
| 822 Layout(); | 825 Layout(); |
| 823 SchedulePaint(); | 826 SchedulePaint(); |
| 824 } | 827 } |
| 825 | 828 |
| 826 int ToolbarView::content_shadow_height() const { | 829 int ToolbarView::content_shadow_height() const { |
| 827 return GetLayoutConstant( | 830 return GetLayoutConstant( |
| 828 (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) ? | 831 (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) ? |
| 829 TOOLBAR_CONTENT_SHADOW_HEIGHT_ASH : TOOLBAR_CONTENT_SHADOW_HEIGHT); | 832 TOOLBAR_CONTENT_SHADOW_HEIGHT_ASH : TOOLBAR_CONTENT_SHADOW_HEIGHT); |
| 830 } | 833 } |
| OLD | NEW |