| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/views/toolbar_view.h" | 5 #include "chrome/browser/views/toolbar_view.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "app/drag_drop_types.h" | 9 #include "app/drag_drop_types.h" |
| 10 #include "app/gfx/canvas.h" | 10 #include "app/gfx/canvas.h" |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 break; | 344 break; |
| 345 } | 345 } |
| 346 if (button) | 346 if (button) |
| 347 button->SetEnabled(enabled); | 347 button->SetEnabled(enabled); |
| 348 } | 348 } |
| 349 | 349 |
| 350 //////////////////////////////////////////////////////////////////////////////// | 350 //////////////////////////////////////////////////////////////////////////////// |
| 351 // ToolbarView, views::Button::ButtonListener implementation: | 351 // ToolbarView, views::Button::ButtonListener implementation: |
| 352 | 352 |
| 353 void ToolbarView::ButtonPressed(views::Button* sender) { | 353 void ToolbarView::ButtonPressed(views::Button* sender) { |
| 354 int id = sender->tag(); |
| 355 switch (id) { |
| 356 case IDC_BACK: |
| 357 case IDC_FORWARD: |
| 358 case IDC_RELOAD: |
| 359 // Forcibly reset the location bar, since otherwise it won't discard any |
| 360 // ongoing user edits, since it doesn't realize this is a user-initiated |
| 361 // action. |
| 362 location_bar_->Revert(); |
| 363 break; |
| 364 } |
| 354 browser_->ExecuteCommandWithDisposition( | 365 browser_->ExecuteCommandWithDisposition( |
| 355 sender->tag(), | 366 id, event_utils::DispositionFromEventFlags(sender->mouse_event_flags())); |
| 356 event_utils::DispositionFromEventFlags(sender->mouse_event_flags())); | |
| 357 } | 367 } |
| 358 | 368 |
| 359 //////////////////////////////////////////////////////////////////////////////// | 369 //////////////////////////////////////////////////////////////////////////////// |
| 360 // ToolbarView, AutocompletePopupPositioner implementation: | 370 // ToolbarView, AutocompletePopupPositioner implementation: |
| 361 | 371 |
| 362 gfx::Rect ToolbarView::GetPopupBounds() const { | 372 gfx::Rect ToolbarView::GetPopupBounds() const { |
| 363 gfx::Point origin; | 373 gfx::Point origin; |
| 364 views::View::ConvertPointToScreen(star_, &origin); | 374 views::View::ConvertPointToScreen(star_, &origin); |
| 365 origin.set_y(origin.y() + star_->height() + kOmniboxPopupVerticalSpacing); | 375 origin.set_y(origin.y() + star_->height() + kOmniboxPopupVerticalSpacing); |
| 366 gfx::Rect popup_bounds(origin.x(), origin.y(), | 376 gfx::Rect popup_bounds(origin.x(), origin.y(), |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1093 app_menu_contents_->AddItem(IDC_ABOUT, | 1103 app_menu_contents_->AddItem(IDC_ABOUT, |
| 1094 l10n_util::GetStringFUTF16( | 1104 l10n_util::GetStringFUTF16( |
| 1095 IDS_ABOUT, | 1105 IDS_ABOUT, |
| 1096 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); | 1106 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); |
| 1097 app_menu_contents_->AddItemWithStringId(IDC_HELP_PAGE, IDS_HELP_PAGE); | 1107 app_menu_contents_->AddItemWithStringId(IDC_HELP_PAGE, IDS_HELP_PAGE); |
| 1098 app_menu_contents_->AddSeparator(); | 1108 app_menu_contents_->AddSeparator(); |
| 1099 app_menu_contents_->AddItemWithStringId(IDC_EXIT, IDS_EXIT); | 1109 app_menu_contents_->AddItemWithStringId(IDC_EXIT, IDS_EXIT); |
| 1100 | 1110 |
| 1101 app_menu_menu_.reset(new views::Menu2(app_menu_contents_.get())); | 1111 app_menu_menu_.reset(new views::Menu2(app_menu_contents_.get())); |
| 1102 } | 1112 } |
| OLD | NEW |