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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 break; | 520 break; |
521 } | 521 } |
522 if (button) | 522 if (button) |
523 button->SetEnabled(enabled); | 523 button->SetEnabled(enabled); |
524 } | 524 } |
525 | 525 |
526 //////////////////////////////////////////////////////////////////////////////// | 526 //////////////////////////////////////////////////////////////////////////////// |
527 // ToolbarView, views::Button::ButtonListener implementation: | 527 // ToolbarView, views::Button::ButtonListener implementation: |
528 | 528 |
529 void ToolbarView::ButtonPressed(views::Button* sender, | 529 void ToolbarView::ButtonPressed(views::Button* sender, |
530 const views::Event& event) { | 530 const ui::Event& event) { |
531 int command = sender->tag(); | 531 int command = sender->tag(); |
532 WindowOpenDisposition disposition = | 532 WindowOpenDisposition disposition = |
533 chrome::DispositionFromEventFlags(sender->mouse_event_flags()); | 533 chrome::DispositionFromEventFlags(sender->mouse_event_flags()); |
534 if ((disposition == CURRENT_TAB) && | 534 if ((disposition == CURRENT_TAB) && |
535 ((command == IDC_BACK) || (command == IDC_FORWARD))) { | 535 ((command == IDC_BACK) || (command == IDC_FORWARD))) { |
536 // Forcibly reset the location bar, since otherwise it won't discard any | 536 // Forcibly reset the location bar, since otherwise it won't discard any |
537 // ongoing user edits, since it doesn't realize this is a user-initiated | 537 // ongoing user edits, since it doesn't realize this is a user-initiated |
538 // action. | 538 // action. |
539 location_bar_->Revert(); | 539 location_bar_->Revert(); |
540 } | 540 } |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 // LocationBarContainer is not a child of the ToolbarView. | 1012 // LocationBarContainer is not a child of the ToolbarView. |
1013 gfx::Point origin(bounds.origin()); | 1013 gfx::Point origin(bounds.origin()); |
1014 views::View::ConvertPointToView(this, location_bar_container_->parent(), | 1014 views::View::ConvertPointToView(this, location_bar_container_->parent(), |
1015 &origin); | 1015 &origin); |
1016 gfx::Rect target_bounds(origin, bounds.size()); | 1016 gfx::Rect target_bounds(origin, bounds.size()); |
1017 if (location_bar_container_->GetTargetBounds() != target_bounds) { | 1017 if (location_bar_container_->GetTargetBounds() != target_bounds) { |
1018 location_bar_container_->SetInToolbar(true); | 1018 location_bar_container_->SetInToolbar(true); |
1019 location_bar_container_->SetBoundsRect(target_bounds); | 1019 location_bar_container_->SetBoundsRect(target_bounds); |
1020 } | 1020 } |
1021 } | 1021 } |
OLD | NEW |