| 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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 button->SetEnabled(enabled); | 500 button->SetEnabled(enabled); |
| 501 } | 501 } |
| 502 | 502 |
| 503 //////////////////////////////////////////////////////////////////////////////// | 503 //////////////////////////////////////////////////////////////////////////////// |
| 504 // ToolbarView, views::Button::ButtonListener implementation: | 504 // ToolbarView, views::Button::ButtonListener implementation: |
| 505 | 505 |
| 506 void ToolbarView::ButtonPressed(views::Button* sender, | 506 void ToolbarView::ButtonPressed(views::Button* sender, |
| 507 const views::Event& event) { | 507 const views::Event& event) { |
| 508 int command = sender->tag(); | 508 int command = sender->tag(); |
| 509 WindowOpenDisposition disposition = | 509 WindowOpenDisposition disposition = |
| 510 browser::DispositionFromEventFlags(sender->mouse_event_flags()); | 510 chrome::DispositionFromEventFlags(sender->mouse_event_flags()); |
| 511 if ((disposition == CURRENT_TAB) && | 511 if ((disposition == CURRENT_TAB) && |
| 512 ((command == IDC_BACK) || (command == IDC_FORWARD))) { | 512 ((command == IDC_BACK) || (command == IDC_FORWARD))) { |
| 513 // Forcibly reset the location bar, since otherwise it won't discard any | 513 // Forcibly reset the location bar, since otherwise it won't discard any |
| 514 // ongoing user edits, since it doesn't realize this is a user-initiated | 514 // ongoing user edits, since it doesn't realize this is a user-initiated |
| 515 // action. | 515 // action. |
| 516 location_bar_->Revert(); | 516 location_bar_->Revert(); |
| 517 } | 517 } |
| 518 chrome::ExecuteCommandWithDisposition(browser_, command, disposition); | 518 chrome::ExecuteCommandWithDisposition(browser_, command, disposition); |
| 519 } | 519 } |
| 520 | 520 |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1000 // LocationBarContainer is not a child of the ToolbarView. | 1000 // LocationBarContainer is not a child of the ToolbarView. |
| 1001 gfx::Point origin(bounds.origin()); | 1001 gfx::Point origin(bounds.origin()); |
| 1002 views::View::ConvertPointToView(this, location_bar_container_->parent(), | 1002 views::View::ConvertPointToView(this, location_bar_container_->parent(), |
| 1003 &origin); | 1003 &origin); |
| 1004 gfx::Rect target_bounds(origin, bounds.size()); | 1004 gfx::Rect target_bounds(origin, bounds.size()); |
| 1005 if (location_bar_container_->GetTargetBounds() != target_bounds) { | 1005 if (location_bar_container_->GetTargetBounds() != target_bounds) { |
| 1006 location_bar_container_->SetInToolbar(true); | 1006 location_bar_container_->SetInToolbar(true); |
| 1007 location_bar_container_->SetBoundsRect(target_bounds); | 1007 location_bar_container_->SetBoundsRect(target_bounds); |
| 1008 } | 1008 } |
| 1009 } | 1009 } |
| OLD | NEW |