| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/accessibility/browser_accessibility_state.h" | 10 #include "chrome/browser/accessibility/browser_accessibility_state.h" |
| 11 #include "chrome/browser/event_disposition.h" |
| 11 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/browser_window.h" | 15 #include "chrome/browser/ui/browser_window.h" |
| 15 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" | 16 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" |
| 16 #include "chrome/browser/ui/view_ids.h" | 17 #include "chrome/browser/ui/view_ids.h" |
| 17 #include "chrome/browser/ui/views/browser_actions_container.h" | 18 #include "chrome/browser/ui/views/browser_actions_container.h" |
| 18 #include "chrome/browser/ui/views/event_utils.h" | |
| 19 #include "chrome/browser/ui/views/wrench_menu.h" | 19 #include "chrome/browser/ui/views/wrench_menu.h" |
| 20 #include "chrome/browser/upgrade_detector.h" | 20 #include "chrome/browser/upgrade_detector.h" |
| 21 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
| 22 #include "content/browser/user_metrics.h" | 22 #include "content/browser/user_metrics.h" |
| 23 #include "content/common/notification_service.h" | 23 #include "content/common/notification_service.h" |
| 24 #include "grit/chromium_strings.h" | 24 #include "grit/chromium_strings.h" |
| 25 #include "grit/generated_resources.h" | 25 #include "grit/generated_resources.h" |
| 26 #include "grit/theme_resources.h" | 26 #include "grit/theme_resources.h" |
| 27 #include "grit/theme_resources_standard.h" | 27 #include "grit/theme_resources_standard.h" |
| 28 #include "ui/base/accessibility/accessible_view_state.h" | 28 #include "ui/base/accessibility/accessible_view_state.h" |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 button->SetEnabled(enabled); | 378 button->SetEnabled(enabled); |
| 379 } | 379 } |
| 380 | 380 |
| 381 //////////////////////////////////////////////////////////////////////////////// | 381 //////////////////////////////////////////////////////////////////////////////// |
| 382 // ToolbarView, views::Button::ButtonListener implementation: | 382 // ToolbarView, views::Button::ButtonListener implementation: |
| 383 | 383 |
| 384 void ToolbarView::ButtonPressed(views::Button* sender, | 384 void ToolbarView::ButtonPressed(views::Button* sender, |
| 385 const views::Event& event) { | 385 const views::Event& event) { |
| 386 int command = sender->tag(); | 386 int command = sender->tag(); |
| 387 WindowOpenDisposition disposition = | 387 WindowOpenDisposition disposition = |
| 388 event_utils::DispositionFromEventFlags(sender->mouse_event_flags()); | 388 browser::DispositionFromEventFlags(sender->mouse_event_flags()); |
| 389 if ((disposition == CURRENT_TAB) && | 389 if ((disposition == CURRENT_TAB) && |
| 390 ((command == IDC_BACK) || (command == IDC_FORWARD))) { | 390 ((command == IDC_BACK) || (command == IDC_FORWARD))) { |
| 391 // Forcibly reset the location bar, since otherwise it won't discard any | 391 // Forcibly reset the location bar, since otherwise it won't discard any |
| 392 // ongoing user edits, since it doesn't realize this is a user-initiated | 392 // ongoing user edits, since it doesn't realize this is a user-initiated |
| 393 // action. | 393 // action. |
| 394 location_bar_->Revert(); | 394 location_bar_->Revert(); |
| 395 } | 395 } |
| 396 browser_->ExecuteCommandWithDisposition(command, disposition); | 396 browser_->ExecuteCommandWithDisposition(command, disposition); |
| 397 } | 397 } |
| 398 | 398 |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); | 688 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); |
| 689 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); | 689 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); |
| 690 } | 690 } |
| 691 | 691 |
| 692 void ToolbarView::UpdateAppMenuBadge() { | 692 void ToolbarView::UpdateAppMenuBadge() { |
| 693 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL)); | 693 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL)); |
| 694 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); | 694 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); |
| 695 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); | 695 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); |
| 696 SchedulePaint(); | 696 SchedulePaint(); |
| 697 } | 697 } |
| OLD | NEW |