| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/reload_button.h" | 5 #include "chrome/browser/views/reload_button.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/views/event_utils.h" | 11 #include "chrome/browser/views/event_utils.h" |
| 11 #include "chrome/browser/views/location_bar/location_bar_view.h" | 12 #include "chrome/browser/views/location_bar/location_bar_view.h" |
| 12 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
| 13 | 14 |
| 14 //////////////////////////////////////////////////////////////////////////////// | 15 //////////////////////////////////////////////////////////////////////////////// |
| 15 // ReloadButton, public: | 16 // ReloadButton, public: |
| 16 | 17 |
| 17 ReloadButton::ReloadButton(LocationBarView* location_bar, Browser* browser) | 18 ReloadButton::ReloadButton(LocationBarView* location_bar, Browser* browser) |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 //////////////////////////////////////////////////////////////////////////////// | 114 //////////////////////////////////////////////////////////////////////////////// |
| 114 // ReloadButton, View overrides: | 115 // ReloadButton, View overrides: |
| 115 | 116 |
| 116 void ReloadButton::OnMouseExited(const views::MouseEvent& e) { | 117 void ReloadButton::OnMouseExited(const views::MouseEvent& e) { |
| 117 ChangeMode(intended_mode_, true); | 118 ChangeMode(intended_mode_, true); |
| 118 if (state() != BS_DISABLED) | 119 if (state() != BS_DISABLED) |
| 119 SetState(BS_NORMAL); | 120 SetState(BS_NORMAL); |
| 120 } | 121 } |
| 121 | 122 |
| 122 bool ReloadButton::GetTooltipText(const gfx::Point& p, std::wstring* tooltip) { | 123 bool ReloadButton::GetTooltipText(const gfx::Point& p, std::wstring* tooltip) { |
| 123 tooltip->assign(l10n_util::GetString((visible_mode_ == MODE_RELOAD) ? | 124 int text_id = visible_mode_ == MODE_RELOAD ? IDS_TOOLTIP_RELOAD |
| 124 IDS_TOOLTIP_RELOAD : IDS_TOOLTIP_STOP)); | 125 : IDS_TOOLTIP_STOP; |
| 126 tooltip->assign(UTF16ToWide(l10n_util::GetStringUTF16(text_id))); |
| 125 return true; | 127 return true; |
| 126 } | 128 } |
| 127 | 129 |
| 128 //////////////////////////////////////////////////////////////////////////////// | 130 //////////////////////////////////////////////////////////////////////////////// |
| 129 // ReloadButton, private: | 131 // ReloadButton, private: |
| 130 | 132 |
| 131 void ReloadButton::OnDoubleClickTimer() { | 133 void ReloadButton::OnDoubleClickTimer() { |
| 132 ChangeMode(intended_mode_, false); | 134 ChangeMode(intended_mode_, false); |
| 133 } | 135 } |
| 134 | 136 |
| 135 void ReloadButton::OnStopToReloadTimer() { | 137 void ReloadButton::OnStopToReloadTimer() { |
| 136 ChangeMode(intended_mode_, true); | 138 ChangeMode(intended_mode_, true); |
| 137 } | 139 } |
| OLD | NEW |