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

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_bar_view.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/bookmarks/bookmark_bar_view.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/i18n/rtl.h" 13 #include "base/i18n/rtl.h"
14 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
15 #include "base/string_util.h" 15 #include "base/string_util.h"
16 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
17 #include "chrome/browser/bookmarks/bookmark_model.h" 17 #include "chrome/browser/bookmarks/bookmark_model.h"
18 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 18 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
19 #include "chrome/browser/bookmarks/bookmark_utils.h" 19 #include "chrome/browser/bookmarks/bookmark_utils.h"
20 #include "chrome/browser/browser_shutdown.h" 20 #include "chrome/browser/browser_shutdown.h"
21 #include "chrome/browser/defaults.h" 21 #include "chrome/browser/defaults.h"
22 #include "chrome/browser/event_disposition.h"
23 #include "chrome/browser/extensions/extension_service.h" 22 #include "chrome/browser/extensions/extension_service.h"
24 #include "chrome/browser/prefs/pref_service.h" 23 #include "chrome/browser/prefs/pref_service.h"
25 #include "chrome/browser/profiles/profile.h" 24 #include "chrome/browser/profiles/profile.h"
26 #include "chrome/browser/sync/profile_sync_service.h" 25 #include "chrome/browser/sync/profile_sync_service.h"
27 #include "chrome/browser/sync/profile_sync_service_factory.h" 26 #include "chrome/browser/sync/profile_sync_service_factory.h"
28 #include "chrome/browser/themes/theme_service.h" 27 #include "chrome/browser/themes/theme_service.h"
29 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" 28 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h"
30 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" 29 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
31 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" 30 #include "chrome/browser/ui/bookmarks/bookmark_utils.h"
32 #include "chrome/browser/ui/browser.h" 31 #include "chrome/browser/ui/browser.h"
(...skipping 21 matching lines...) Expand all
54 #include "grit/generated_resources.h" 53 #include "grit/generated_resources.h"
55 #include "grit/theme_resources.h" 54 #include "grit/theme_resources.h"
56 #include "grit/ui_resources.h" 55 #include "grit/ui_resources.h"
57 #include "ui/base/accessibility/accessible_view_state.h" 56 #include "ui/base/accessibility/accessible_view_state.h"
58 #include "ui/base/animation/slide_animation.h" 57 #include "ui/base/animation/slide_animation.h"
59 #include "ui/base/dragdrop/drag_utils.h" 58 #include "ui/base/dragdrop/drag_utils.h"
60 #include "ui/base/dragdrop/os_exchange_data.h" 59 #include "ui/base/dragdrop/os_exchange_data.h"
61 #include "ui/base/l10n/l10n_util.h" 60 #include "ui/base/l10n/l10n_util.h"
62 #include "ui/base/resource/resource_bundle.h" 61 #include "ui/base/resource/resource_bundle.h"
63 #include "ui/base/text/text_elider.h" 62 #include "ui/base/text/text_elider.h"
63 #include "ui/base/window_open_disposition.h"
64 #include "ui/gfx/canvas.h" 64 #include "ui/gfx/canvas.h"
65 #include "ui/views/button_drag_utils.h" 65 #include "ui/views/button_drag_utils.h"
66 #include "ui/views/controls/button/menu_button.h" 66 #include "ui/views/controls/button/menu_button.h"
67 #include "ui/views/controls/label.h" 67 #include "ui/views/controls/label.h"
68 #include "ui/views/controls/menu/menu_item_view.h" 68 #include "ui/views/controls/menu/menu_item_view.h"
69 #include "ui/views/drag_utils.h" 69 #include "ui/views/drag_utils.h"
70 #include "ui/views/metrics.h" 70 #include "ui/views/metrics.h"
71 #include "ui/views/view_constants.h" 71 #include "ui/views/view_constants.h"
72 #include "ui/views/widget/tooltip_manager.h" 72 #include "ui/views/widget/tooltip_manager.h"
73 #include "ui/views/widget/widget.h" 73 #include "ui/views/widget/widget.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 virtual bool IsTriggerableEvent(const ui::Event& e) OVERRIDE { 222 virtual bool IsTriggerableEvent(const ui::Event& e) OVERRIDE {
223 // Left clicks and taps should show the menu contents and right clicks 223 // Left clicks and taps should show the menu contents and right clicks
224 // should show the context menu. They should not trigger the opening of 224 // should show the context menu. They should not trigger the opening of
225 // underlying urls. 225 // underlying urls.
226 if (e.type() == ui::ET_GESTURE_TAP || 226 if (e.type() == ui::ET_GESTURE_TAP ||
227 (e.IsMouseEvent() && (e.flags() & 227 (e.IsMouseEvent() && (e.flags() &
228 (ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON)))) 228 (ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON))))
229 return false; 229 return false;
230 230
231 if (e.IsMouseEvent()) 231 if (e.IsMouseEvent())
232 return chrome::DispositionFromEventFlags(e.flags()) != CURRENT_TAB; 232 return ui::DispositionFromEventFlags(e.flags()) != CURRENT_TAB;
233 return false; 233 return false;
234 } 234 }
235 235
236 virtual void OnPaint(gfx::Canvas* canvas) { 236 virtual void OnPaint(gfx::Canvas* canvas) {
237 views::MenuButton::PaintButton(canvas, views::MenuButton::PB_NORMAL); 237 views::MenuButton::PaintButton(canvas, views::MenuButton::PB_NORMAL);
238 } 238 }
239 239
240 private: 240 private:
241 scoped_ptr<ui::SlideAnimation> show_animation_; 241 scoped_ptr<ui::SlideAnimation> show_animation_;
242 242
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 if (sender->tag() == kOtherFolderButtonTag) { 1051 if (sender->tag() == kOtherFolderButtonTag) {
1052 node = model_->other_node(); 1052 node = model_->other_node();
1053 } else { 1053 } else {
1054 int index = GetIndexOf(sender); 1054 int index = GetIndexOf(sender);
1055 DCHECK_NE(-1, index); 1055 DCHECK_NE(-1, index);
1056 node = model_->bookmark_bar_node()->GetChild(index); 1056 node = model_->bookmark_bar_node()->GetChild(index);
1057 } 1057 }
1058 DCHECK(page_navigator_); 1058 DCHECK(page_navigator_);
1059 1059
1060 WindowOpenDisposition disposition_from_event_flags = 1060 WindowOpenDisposition disposition_from_event_flags =
1061 chrome::DispositionFromEventFlags(event.flags()); 1061 ui::DispositionFromEventFlags(event.flags());
1062 1062
1063 if (node->is_url()) { 1063 if (node->is_url()) {
1064 RecordAppLaunch(browser_->profile(), node->url()); 1064 RecordAppLaunch(browser_->profile(), node->url());
1065 OpenURLParams params( 1065 OpenURLParams params(
1066 node->url(), Referrer(), disposition_from_event_flags, 1066 node->url(), Referrer(), disposition_from_event_flags,
1067 content::PAGE_TRANSITION_AUTO_BOOKMARK, false); 1067 content::PAGE_TRANSITION_AUTO_BOOKMARK, false);
1068 page_navigator_->OpenURL(params); 1068 page_navigator_->OpenURL(params);
1069 } else { 1069 } else {
1070 chrome::OpenAll(GetWidget()->GetNativeWindow(), page_navigator_, node, 1070 chrome::OpenAll(GetWidget()->GetNativeWindow(), page_navigator_, node,
1071 disposition_from_event_flags, browser_->profile()); 1071 disposition_from_event_flags, browser_->profile());
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
1669 (1 - size_animation_->GetCurrentValue()))); 1669 (1 - size_animation_->GetCurrentValue())));
1670 } else { 1670 } else {
1671 prefsize.set_height( 1671 prefsize.set_height(
1672 static_cast<int>( 1672 static_cast<int>(
1673 browser_defaults::kBookmarkBarHeight * 1673 browser_defaults::kBookmarkBarHeight *
1674 size_animation_->GetCurrentValue())); 1674 size_animation_->GetCurrentValue()));
1675 } 1675 }
1676 } 1676 }
1677 return prefsize; 1677 return prefsize;
1678 } 1678 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698