diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-11 01:36:48 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-11 01:36:48 +0000 |
commit | 7d99adc5000d0eac89bccc378b1eef4a1fa76c48 (patch) | |
tree | ad947c0695581aad52f2c4f66388ede9a9b8bfb7 | |
parent | 7b0f750bf7b0ccd2f0962817bab1460342d113e9 (diff) | |
download | chromium_src-7d99adc5000d0eac89bccc378b1eef4a1fa76c48.zip chromium_src-7d99adc5000d0eac89bccc378b1eef4a1fa76c48.tar.gz chromium_src-7d99adc5000d0eac89bccc378b1eef4a1fa76c48.tar.bz2 |
views: Get rid of event_utils::DispositionFromEventFlags wrapper function.
This function is just a wrapper around the another function, so we can get rid
of it now.
NOTE: This was a TODO for shinyak.
R=ben@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10458021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141385 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/event_disposition.h | 10 | ||||
-rw-r--r-- | chrome/browser/ui/views/accessibility/invert_bubble_view.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/views/ash/app_list/search_builder.cc | 7 | ||||
-rw-r--r-- | chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc | 7 | ||||
-rw-r--r-- | chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc | 6 | ||||
-rw-r--r-- | chrome/browser/ui/views/chrome_views_delegate.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/views/event_utils.cc | 13 | ||||
-rw-r--r-- | chrome/browser/ui/views/event_utils.h | 17 | ||||
-rw-r--r-- | chrome/browser/ui/views/infobars/confirm_infobar.cc | 6 | ||||
-rw-r--r-- | chrome/browser/ui/views/infobars/link_infobar.cc | 6 | ||||
-rw-r--r-- | chrome/browser/ui/views/network_profile_bubble.cc | 3 | ||||
-rw-r--r-- | chrome/browser/ui/views/reload_button.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/views/toolbar_view.cc | 4 |
14 files changed, 38 insertions, 57 deletions
diff --git a/chrome/browser/event_disposition.h b/chrome/browser/event_disposition.h index 19c7ebc..f8ef4d3 100644 --- a/chrome/browser/event_disposition.h +++ b/chrome/browser/event_disposition.h @@ -1,9 +1,9 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EVENT_DISPOSITION_H__ -#define CHROME_BROWSER_EVENT_DISPOSITION_H__ +#ifndef CHROME_BROWSER_EVENT_DISPOSITION_H_ +#define CHROME_BROWSER_EVENT_DISPOSITION_H_ #pragma once #include "webkit/glue/window_open_disposition.h" @@ -15,6 +15,6 @@ namespace browser { // event_flags are the flags as understood by views::MouseEvent. WindowOpenDisposition DispositionFromEventFlags(int event_flags); -} +} // namespace browser -#endif // CHROME_BROWSER_EVENT_DISPOSITION_H__ +#endif // CHROME_BROWSER_EVENT_DISPOSITION_H_ diff --git a/chrome/browser/ui/views/accessibility/invert_bubble_view.cc b/chrome/browser/ui/views/accessibility/invert_bubble_view.cc index 36fd36a..9121343 100644 --- a/chrome/browser/ui/views/accessibility/invert_bubble_view.cc +++ b/chrome/browser/ui/views/accessibility/invert_bubble_view.cc @@ -5,12 +5,12 @@ #include "chrome/browser/ui/views/accessibility/invert_bubble_view.h" #include "base/utf_string_conversions.h" +#include "chrome/browser/event_disposition.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_list.h" -#include "chrome/browser/ui/views/event_utils.h" #include "chrome/common/pref_names.h" #include "content/public/browser/page_navigator.h" #include "grit/generated_resources.h" @@ -149,7 +149,7 @@ void InvertBubbleView::OpenLink(const std::string& url, int event_flags) { Browser* browser = browser::FindLastActiveWithProfile(profile_); if (browser) { WindowOpenDisposition disposition = - event_utils::DispositionFromEventFlags(event_flags); + browser::DispositionFromEventFlags(event_flags); content::OpenURLParams params( GURL(url), content::Referrer(), disposition == CURRENT_TAB ? NEW_FOREGROUND_TAB : disposition, diff --git a/chrome/browser/ui/views/ash/app_list/search_builder.cc b/chrome/browser/ui/views/ash/app_list/search_builder.cc index 2f57fd1..8819caa 100644 --- a/chrome/browser/ui/views/ash/app_list/search_builder.cc +++ b/chrome/browser/ui/views/ash/app_list/search_builder.cc @@ -6,13 +6,13 @@ #include "chrome/browser/autocomplete/autocomplete.h" #include "chrome/browser/autocomplete/autocomplete_match.h" +#include "chrome/browser/event_disposition.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/search_engines/template_url.h" -#include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/views/ash/extension_utils.h" -#include "chrome/browser/ui/views/event_utils.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "ui/app_list/search_box_model.h" @@ -175,8 +175,7 @@ void SearchBuilder::OpenResult(const app_list::SearchResult& result, browser->OpenURL( content::OpenURLParams(match.destination_url, content::Referrer(), - event_utils::DispositionFromEventFlags( - event_flags), + browser::DispositionFromEventFlags(event_flags), match.transition, false)); } diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc index b23a163..29a1abd 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc @@ -18,6 +18,7 @@ #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/browser_shutdown.h" #include "chrome/browser/defaults.h" +#include "chrome/browser/event_disposition.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" @@ -217,9 +218,7 @@ class BookmarkFolderButton : public views::MenuButton { e.flags() == ui::EF_RIGHT_MOUSE_BUTTON) return false; - WindowOpenDisposition disposition( - event_utils::DispositionFromEventFlags(e.flags())); - return disposition != CURRENT_TAB; + return browser::DispositionFromEventFlags(e.flags()) != CURRENT_TAB; } virtual void OnPaint(gfx::Canvas* canvas) { @@ -1030,7 +1029,7 @@ void BookmarkBarView::ButtonPressed(views::Button* sender, DCHECK(page_navigator_); WindowOpenDisposition disposition_from_event_flags = - event_utils::DispositionFromEventFlags(sender->mouse_event_flags()); + browser::DispositionFromEventFlags(sender->mouse_event_flags()); Profile* profile = browser_->profile(); if (node->is_url()) { diff --git a/chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.cc b/chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.cc index 4de786d..b1ba50f 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,11 +9,11 @@ #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_node_data.h" #include "chrome/browser/bookmarks/bookmark_utils.h" +#include "chrome/browser/event_disposition.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" #include "chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.h" -#include "chrome/browser/ui/views/event_utils.h" #include "chrome/common/pref_names.h" #include "content/public/browser/page_navigator.h" #include "content/public/browser/user_metrics.h" diff --git a/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc b/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc index 882479c..1e585456 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc @@ -8,6 +8,7 @@ #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_node_data.h" #include "chrome/browser/bookmarks/bookmark_utils.h" +#include "chrome/browser/event_disposition.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" @@ -122,11 +123,8 @@ void BookmarkMenuDelegate::ExecuteCommand(int id, int mouse_event_flags) { std::vector<const BookmarkNode*> selection; selection.push_back(node); - WindowOpenDisposition initial_disposition = - event_utils::DispositionFromEventFlags(mouse_event_flags); - bookmark_utils::OpenAll(parent_->GetNativeWindow(), profile_, page_navigator_, - selection, initial_disposition); + selection, browser::DispositionFromEventFlags(mouse_event_flags)); bookmark_utils::RecordBookmarkLaunch(location_); } diff --git a/chrome/browser/ui/views/chrome_views_delegate.cc b/chrome/browser/ui/views/chrome_views_delegate.cc index 3bed5be..001c203 100644 --- a/chrome/browser/ui/views/chrome_views_delegate.cc +++ b/chrome/browser/ui/views/chrome_views_delegate.cc @@ -8,11 +8,11 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/event_disposition.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/views/accessibility/accessibility_event_router_views.h" -#include "chrome/browser/ui/views/event_utils.h" #include "chrome/common/pref_names.h" #include "ui/base/clipboard/clipboard.h" #include "ui/gfx/rect.h" @@ -157,7 +157,7 @@ void ChromeViewsDelegate::ReleaseRef() { } int ChromeViewsDelegate::GetDispositionForEvent(int event_flags) { - return event_utils::DispositionFromEventFlags(event_flags); + return browser::DispositionFromEventFlags(event_flags); } #if defined(USE_AURA) diff --git a/chrome/browser/ui/views/event_utils.cc b/chrome/browser/ui/views/event_utils.cc index 3a1078e..f396f54 100644 --- a/chrome/browser/ui/views/event_utils.cc +++ b/chrome/browser/ui/views/event_utils.cc @@ -1,22 +1,15 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/event_disposition.h" #include "chrome/browser/ui/views/event_utils.h" -#include "ui/views/events/event.h" -using views::Event; +#include "ui/views/events/event.h" namespace event_utils { -// TODO(shinyak) After refactoring, this function shoulbe removed. -WindowOpenDisposition DispositionFromEventFlags(int event_flags) { - return browser::DispositionFromEventFlags(event_flags); -} - bool IsPossibleDispositionEvent(const views::MouseEvent& event) { return event.IsLeftMouseButton() || event.IsMiddleMouseButton(); } -} +} // namespace event_utils diff --git a/chrome/browser/ui/views/event_utils.h b/chrome/browser/ui/views/event_utils.h index 9d37c53..9bf6949 100644 --- a/chrome/browser/ui/views/event_utils.h +++ b/chrome/browser/ui/views/event_utils.h @@ -1,28 +1,21 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_VIEWS_EVENT_UTILS_H__ -#define CHROME_BROWSER_UI_VIEWS_EVENT_UTILS_H__ +#ifndef CHROME_BROWSER_UI_VIEWS_EVENT_UTILS_H_ +#define CHROME_BROWSER_UI_VIEWS_EVENT_UTILS_H_ #pragma once -#include "webkit/glue/window_open_disposition.h" - namespace views { class MouseEvent; } namespace event_utils { -// Translates event flags into what kind of disposition they represents. -// For example, a middle click would mean to open a background tab. -// event_flags are the flags as understood by views::MouseEvent. -WindowOpenDisposition DispositionFromEventFlags(int event_flags); - // Returns true if the specified mouse event may have a // WindowOptionDisposition. bool IsPossibleDispositionEvent(const views::MouseEvent& event); -} +} // namespace event_utils -#endif // CHROME_BROWSER_UI_VIEWS_EVENT_UTILS_H__ +#endif // CHROME_BROWSER_UI_VIEWS_EVENT_UTILS_H_ diff --git a/chrome/browser/ui/views/infobars/confirm_infobar.cc b/chrome/browser/ui/views/infobars/confirm_infobar.cc index 6b2418b..7917473 100644 --- a/chrome/browser/ui/views/infobars/confirm_infobar.cc +++ b/chrome/browser/ui/views/infobars/confirm_infobar.cc @@ -1,12 +1,12 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/ui/views/infobars/confirm_infobar.h" #include "base/logging.h" +#include "chrome/browser/event_disposition.h" #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" -#include "chrome/browser/ui/views/event_utils.h" #include "ui/views/controls/button/text_button.h" #include "ui/views/controls/label.h" #include "ui/views/controls/link.h" @@ -129,7 +129,7 @@ void ConfirmInfoBar::LinkClicked(views::Link* source, int event_flags) { DCHECK(link_ != NULL); DCHECK_EQ(link_, source); if (GetDelegate()->LinkClicked( - event_utils::DispositionFromEventFlags(event_flags))) + browser::DispositionFromEventFlags(event_flags))) RemoveSelf(); } diff --git a/chrome/browser/ui/views/infobars/link_infobar.cc b/chrome/browser/ui/views/infobars/link_infobar.cc index 60c4fb9..8569508 100644 --- a/chrome/browser/ui/views/infobars/link_infobar.cc +++ b/chrome/browser/ui/views/infobars/link_infobar.cc @@ -1,12 +1,12 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/ui/views/infobars/link_infobar.h" #include "base/logging.h" +#include "chrome/browser/event_disposition.h" #include "chrome/browser/tab_contents/link_infobar_delegate.h" -#include "chrome/browser/ui/views/event_utils.h" #include "ui/views/controls/label.h" #include "ui/views/controls/link.h" @@ -77,7 +77,7 @@ void LinkInfoBar::LinkClicked(views::Link* source, int event_flags) { DCHECK(link_ != NULL); DCHECK_EQ(link_, source); if (GetDelegate()->LinkClicked( - event_utils::DispositionFromEventFlags(event_flags))) + browser::DispositionFromEventFlags(event_flags))) RemoveSelf(); } diff --git a/chrome/browser/ui/views/network_profile_bubble.cc b/chrome/browser/ui/views/network_profile_bubble.cc index b1020d0..1b32f26 100644 --- a/chrome/browser/ui/views/network_profile_bubble.cc +++ b/chrome/browser/ui/views/network_profile_bubble.cc @@ -19,7 +19,6 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/network_profile_bubble_prefs.h" -#include "chrome/browser/ui/views/event_utils.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/toolbar_view.h" #include "chrome/common/chrome_switches.h" @@ -275,7 +274,7 @@ gfx::Rect NetworkProfileBubble::GetAnchorRect() { void NetworkProfileBubble::LinkClicked(views::Link* source, int event_flags) { RecordUmaEvent(METRIC_LEARN_MORE_CLICKED); WindowOpenDisposition disposition = - event_utils::DispositionFromEventFlags(event_flags); + browser::DispositionFromEventFlags(event_flags); content::OpenURLParams params( GURL("https://sites.google.com/a/chromium.org/dev/administrators/" "common-problems-and-solutions#network_profile"), diff --git a/chrome/browser/ui/views/reload_button.cc b/chrome/browser/ui/views/reload_button.cc index efb6b2b..75a9d8a 100644 --- a/chrome/browser/ui/views/reload_button.cc +++ b/chrome/browser/ui/views/reload_button.cc @@ -7,7 +7,7 @@ #include "base/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/command_updater.h" -#include "chrome/browser/ui/views/event_utils.h" +#include "chrome/browser/event_disposition.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -92,7 +92,7 @@ void ReloadButton::ButtonPressed(views::Button* /* button */, } WindowOpenDisposition disposition = - event_utils::DispositionFromEventFlags(flags); + browser::DispositionFromEventFlags(flags); if ((disposition == CURRENT_TAB) && location_bar_) { // Forcibly reset the location bar, since otherwise it won't discard any // ongoing user edits, since it doesn't realize this is a user-initiated diff --git a/chrome/browser/ui/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc index 0e5ec58..dbce920 100644 --- a/chrome/browser/ui/views/toolbar_view.cc +++ b/chrome/browser/ui/views/toolbar_view.cc @@ -7,6 +7,7 @@ #include "base/i18n/number_formatting.h" #include "base/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" +#include "chrome/browser/event_disposition.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" @@ -17,7 +18,6 @@ #include "chrome/browser/ui/toolbar/wrench_menu_model.h" #include "chrome/browser/ui/view_ids.h" #include "chrome/browser/ui/views/browser_actions_container.h" -#include "chrome/browser/ui/views/event_utils.h" #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" #include "chrome/browser/ui/views/wrench_menu.h" #include "chrome/browser/upgrade_detector.h" @@ -442,7 +442,7 @@ void ToolbarView::ButtonPressed(views::Button* sender, const views::Event& event) { int command = sender->tag(); WindowOpenDisposition disposition = - event_utils::DispositionFromEventFlags(sender->mouse_event_flags()); + browser::DispositionFromEventFlags(sender->mouse_event_flags()); if ((disposition == CURRENT_TAB) && ((command == IDC_BACK) || (command == IDC_FORWARD))) { // Forcibly reset the location bar, since otherwise it won't discard any |