Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: chrome/browser/ui/views/reload_button.cc

Issue 11896047: Move the methods in disposition_utils.h and event_disposition.h to ui\base\window_open_disposition.… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix regex in ui.gyp Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/reload_button.h" 5 #include "chrome/browser/ui/views/reload_button.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #include "chrome/browser/command_updater.h" 9 #include "chrome/browser/command_updater.h"
10 #include "chrome/browser/event_disposition.h"
11 #include "chrome/browser/ui/search/search.h" 10 #include "chrome/browser/ui/search/search.h"
12 #include "chrome/browser/ui/search/search_model.h" 11 #include "chrome/browser/ui/search/search_model.h"
13 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 12 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
14 #include "grit/generated_resources.h" 13 #include "grit/generated_resources.h"
15 #include "grit/theme_resources.h" 14 #include "grit/theme_resources.h"
16 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
17 #include "ui/base/models/simple_menu_model.h" 16 #include "ui/base/models/simple_menu_model.h"
18 #include "ui/base/theme_provider.h" 17 #include "ui/base/theme_provider.h"
18 #include "ui/base/window_open_disposition.h"
19 #include "ui/views/metrics.h" 19 #include "ui/views/metrics.h"
20 #include "ui/views/widget/widget.h" 20 #include "ui/views/widget/widget.h"
21 21
22 // static 22 // static
23 const char ReloadButton::kViewClassName[] = "browser/ui/views/ReloadButton"; 23 const char ReloadButton::kViewClassName[] = "browser/ui/views/ReloadButton";
24 24
25 const int kReloadImages[] = 25 const int kReloadImages[] =
26 { IDR_RELOAD, IDR_RELOAD_H, IDR_RELOAD_P, IDR_RELOAD_D }; 26 { IDR_RELOAD, IDR_RELOAD_H, IDR_RELOAD_P, IDR_RELOAD_D };
27 27
28 const int kStopImages[] = { IDR_STOP, IDR_STOP_H, IDR_STOP_P, IDR_STOP_D }; 28 const int kStopImages[] = { IDR_STOP, IDR_STOP_H, IDR_STOP_P, IDR_STOP_D };
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 kReloadMenuItems[i]); 235 kReloadMenuItems[i]);
236 } 236 }
237 return menu_model_; 237 return menu_model_;
238 } 238 }
239 239
240 void ReloadButton::ExecuteBrowserCommand(int command, int event_flags) { 240 void ReloadButton::ExecuteBrowserCommand(int command, int event_flags) {
241 if (!command_updater_) 241 if (!command_updater_)
242 return; 242 return;
243 243
244 WindowOpenDisposition disposition = 244 WindowOpenDisposition disposition =
245 chrome::DispositionFromEventFlags(event_flags); 245 ui::DispositionFromEventFlags(event_flags);
246 if ((disposition == CURRENT_TAB) && location_bar_) { 246 if ((disposition == CURRENT_TAB) && location_bar_) {
247 // Forcibly reset the location bar, since otherwise it won't discard any 247 // Forcibly reset the location bar, since otherwise it won't discard any
248 // ongoing user edits, since it doesn't realize this is a user-initiated 248 // ongoing user edits, since it doesn't realize this is a user-initiated
249 // action. 249 // action.
250 location_bar_->Revert(); 250 location_bar_->Revert();
251 } 251 }
252 command_updater_->ExecuteCommandWithDisposition(command, disposition); 252 command_updater_->ExecuteCommandWithDisposition(command, disposition);
253 } 253 }
254 254
255 void ReloadButton::ChangeModeInternal(Mode mode) { 255 void ReloadButton::ChangeModeInternal(Mode mode) {
256 if (visible_mode_ == mode) 256 if (visible_mode_ == mode)
257 return; 257 return;
258 258
259 for (size_t i = 0; i < STATE_COUNT; ++i) 259 for (size_t i = 0; i < STATE_COUNT; ++i)
260 std::swap(images_[i], alternate_images_[i]); 260 std::swap(images_[i], alternate_images_[i]);
261 visible_mode_ = mode; 261 visible_mode_ = mode;
262 SchedulePaint(); 262 SchedulePaint();
263 } 263 }
264 264
265 void ReloadButton::OnDoubleClickTimer() { 265 void ReloadButton::OnDoubleClickTimer() {
266 if (!IsMenuShowing()) 266 if (!IsMenuShowing())
267 ChangeMode(intended_mode_, false); 267 ChangeMode(intended_mode_, false);
268 } 268 }
269 269
270 void ReloadButton::OnStopToReloadTimer() { 270 void ReloadButton::OnStopToReloadTimer() {
271 DCHECK(!IsMenuShowing()); 271 DCHECK(!IsMenuShowing());
272 ChangeMode(intended_mode_, true); 272 ChangeMode(intended_mode_, true);
273 } 273 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/network_profile_bubble_view.cc ('k') | chrome/browser/ui/views/toolbar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698