| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_view.h" | 5 #include "chrome/browser/ui/views/toolbar_view.h" |
| 6 | 6 |
| 7 #include "base/i18n/number_formatting.h" | 7 #include "base/i18n/number_formatting.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/command_updater.h" | 10 #include "chrome/browser/command_updater.h" |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 forward_->set_tag(IDC_FORWARD); | 241 forward_->set_tag(IDC_FORWARD); |
| 242 forward_->SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_FORWARD)); | 242 forward_->SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_FORWARD)); |
| 243 forward_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_FORWARD)); | 243 forward_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_FORWARD)); |
| 244 forward_->set_id(VIEW_ID_FORWARD_BUTTON); | 244 forward_->set_id(VIEW_ID_FORWARD_BUTTON); |
| 245 | 245 |
| 246 // Have to create this before |reload_| as |reload_|'s constructor needs it. | 246 // Have to create this before |reload_| as |reload_|'s constructor needs it. |
| 247 location_bar_container_ = new LocationBarContainer( | 247 location_bar_container_ = new LocationBarContainer( |
| 248 location_bar_parent, | 248 location_bar_parent, |
| 249 chrome::search::IsInstantExtendedAPIEnabled(browser_->profile())); | 249 chrome::search::IsInstantExtendedAPIEnabled(browser_->profile())); |
| 250 location_bar_ = new LocationBarView( | 250 location_bar_ = new LocationBarView( |
| 251 browser_, |
| 251 browser_->profile(), | 252 browser_->profile(), |
| 252 browser_->command_controller()->command_updater(), | 253 browser_->command_controller()->command_updater(), |
| 253 model_, | 254 model_, |
| 254 this, | 255 this, |
| 255 browser_->search_model(), | 256 browser_->search_model(), |
| 256 (display_mode_ == DISPLAYMODE_LOCATION) ? | 257 (display_mode_ == DISPLAYMODE_LOCATION) ? |
| 257 LocationBarView::POPUP : LocationBarView::NORMAL); | 258 LocationBarView::POPUP : LocationBarView::NORMAL); |
| 258 // TODO(sky): if we want this to work on windows we need to make sure the | 259 // TODO(sky): if we want this to work on windows we need to make sure the |
| 259 // LocationBarContainer gets focus. This will involve tweaking view_ids. | 260 // LocationBarContainer gets focus. This will involve tweaking view_ids. |
| 260 // location_bar_->set_view_to_focus(location_bar_container_); | 261 // location_bar_->set_view_to_focus(location_bar_container_); |
| (...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1027 // LocationBarContainer is not a child of the ToolbarView. | 1028 // LocationBarContainer is not a child of the ToolbarView. |
| 1028 gfx::Point origin(bounds.origin()); | 1029 gfx::Point origin(bounds.origin()); |
| 1029 views::View::ConvertPointToView(this, location_bar_container_->parent(), | 1030 views::View::ConvertPointToView(this, location_bar_container_->parent(), |
| 1030 &origin); | 1031 &origin); |
| 1031 gfx::Rect target_bounds(origin, bounds.size()); | 1032 gfx::Rect target_bounds(origin, bounds.size()); |
| 1032 if (location_bar_container_->GetTargetBounds() != target_bounds) { | 1033 if (location_bar_container_->GetTargetBounds() != target_bounds) { |
| 1033 location_bar_container_->SetInToolbar(true); | 1034 location_bar_container_->SetInToolbar(true); |
| 1034 location_bar_container_->SetBoundsRect(target_bounds); | 1035 location_bar_container_->SetBoundsRect(target_bounds); |
| 1035 } | 1036 } |
| 1036 } | 1037 } |
| OLD | NEW |