OLD | NEW |
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 <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 #include "chrome/grit/generated_resources.h" | 53 #include "chrome/grit/generated_resources.h" |
54 #include "components/bookmarks/browser/bookmark_model.h" | 54 #include "components/bookmarks/browser/bookmark_model.h" |
55 #include "components/metrics/metrics_service.h" | 55 #include "components/metrics/metrics_service.h" |
56 #include "content/public/browser/notification_details.h" | 56 #include "content/public/browser/notification_details.h" |
57 #include "content/public/browser/notification_source.h" | 57 #include "content/public/browser/notification_source.h" |
58 #include "content/public/browser/page_navigator.h" | 58 #include "content/public/browser/page_navigator.h" |
59 #include "content/public/browser/render_view_host.h" | 59 #include "content/public/browser/render_view_host.h" |
60 #include "content/public/browser/render_widget_host_view.h" | 60 #include "content/public/browser/render_widget_host_view.h" |
61 #include "content/public/browser/user_metrics.h" | 61 #include "content/public/browser/user_metrics.h" |
62 #include "content/public/browser/web_contents.h" | 62 #include "content/public/browser/web_contents.h" |
63 #include "content/public/common/page_transition_types.h" | |
64 #include "extensions/browser/extension_registry.h" | 63 #include "extensions/browser/extension_registry.h" |
65 #include "extensions/common/extension.h" | 64 #include "extensions/common/extension.h" |
66 #include "extensions/common/extension_set.h" | 65 #include "extensions/common/extension_set.h" |
67 #include "grit/theme_resources.h" | 66 #include "grit/theme_resources.h" |
68 #include "ui/accessibility/ax_view_state.h" | 67 #include "ui/accessibility/ax_view_state.h" |
69 #include "ui/base/dragdrop/drag_utils.h" | 68 #include "ui/base/dragdrop/drag_utils.h" |
70 #include "ui/base/dragdrop/os_exchange_data.h" | 69 #include "ui/base/dragdrop/os_exchange_data.h" |
71 #include "ui/base/l10n/l10n_util.h" | 70 #include "ui/base/l10n/l10n_util.h" |
| 71 #include "ui/base/page_transition_types.h" |
72 #include "ui/base/resource/resource_bundle.h" | 72 #include "ui/base/resource/resource_bundle.h" |
73 #include "ui/base/theme_provider.h" | 73 #include "ui/base/theme_provider.h" |
74 #include "ui/base/window_open_disposition.h" | 74 #include "ui/base/window_open_disposition.h" |
75 #include "ui/gfx/animation/slide_animation.h" | 75 #include "ui/gfx/animation/slide_animation.h" |
76 #include "ui/gfx/canvas.h" | 76 #include "ui/gfx/canvas.h" |
77 #include "ui/gfx/text_constants.h" | 77 #include "ui/gfx/text_constants.h" |
78 #include "ui/gfx/text_elider.h" | 78 #include "ui/gfx/text_elider.h" |
79 #include "ui/resources/grit/ui_resources.h" | 79 #include "ui/resources/grit/ui_resources.h" |
80 #include "ui/views/button_drag_utils.h" | 80 #include "ui/views/button_drag_utils.h" |
81 #include "ui/views/controls/button/label_button.h" | 81 #include "ui/views/controls/button/label_button.h" |
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1262 | 1262 |
1263 void BookmarkBarView::ButtonPressed(views::Button* sender, | 1263 void BookmarkBarView::ButtonPressed(views::Button* sender, |
1264 const ui::Event& event) { | 1264 const ui::Event& event) { |
1265 WindowOpenDisposition disposition_from_event_flags = | 1265 WindowOpenDisposition disposition_from_event_flags = |
1266 ui::DispositionFromEventFlags(event.flags()); | 1266 ui::DispositionFromEventFlags(event.flags()); |
1267 | 1267 |
1268 if (sender->tag() == kAppsShortcutButtonTag) { | 1268 if (sender->tag() == kAppsShortcutButtonTag) { |
1269 OpenURLParams params(GURL(chrome::kChromeUIAppsURL), | 1269 OpenURLParams params(GURL(chrome::kChromeUIAppsURL), |
1270 Referrer(), | 1270 Referrer(), |
1271 disposition_from_event_flags, | 1271 disposition_from_event_flags, |
1272 content::PAGE_TRANSITION_AUTO_BOOKMARK, | 1272 ui::PAGE_TRANSITION_AUTO_BOOKMARK, |
1273 false); | 1273 false); |
1274 page_navigator_->OpenURL(params); | 1274 page_navigator_->OpenURL(params); |
1275 RecordBookmarkAppsPageOpen(GetBookmarkLaunchLocation()); | 1275 RecordBookmarkAppsPageOpen(GetBookmarkLaunchLocation()); |
1276 return; | 1276 return; |
1277 } | 1277 } |
1278 | 1278 |
1279 const BookmarkNode* node; | 1279 const BookmarkNode* node; |
1280 if (sender->tag() == kOtherFolderButtonTag) { | 1280 if (sender->tag() == kOtherFolderButtonTag) { |
1281 node = model_->other_node(); | 1281 node = model_->other_node(); |
1282 } else if (sender->tag() == kManagedFolderButtonTag) { | 1282 } else if (sender->tag() == kManagedFolderButtonTag) { |
1283 node = client_->managed_node(); | 1283 node = client_->managed_node(); |
1284 } else { | 1284 } else { |
1285 int index = GetIndexOf(sender); | 1285 int index = GetIndexOf(sender); |
1286 DCHECK_NE(-1, index); | 1286 DCHECK_NE(-1, index); |
1287 node = model_->bookmark_bar_node()->GetChild(index); | 1287 node = model_->bookmark_bar_node()->GetChild(index); |
1288 } | 1288 } |
1289 DCHECK(page_navigator_); | 1289 DCHECK(page_navigator_); |
1290 | 1290 |
1291 if (node->is_url()) { | 1291 if (node->is_url()) { |
1292 RecordAppLaunch(browser_->profile(), node->url()); | 1292 RecordAppLaunch(browser_->profile(), node->url()); |
1293 OpenURLParams params( | 1293 OpenURLParams params( |
1294 node->url(), Referrer(), disposition_from_event_flags, | 1294 node->url(), Referrer(), disposition_from_event_flags, |
1295 content::PAGE_TRANSITION_AUTO_BOOKMARK, false); | 1295 ui::PAGE_TRANSITION_AUTO_BOOKMARK, false); |
1296 page_navigator_->OpenURL(params); | 1296 page_navigator_->OpenURL(params); |
1297 } else { | 1297 } else { |
1298 chrome::OpenAll(GetWidget()->GetNativeWindow(), page_navigator_, node, | 1298 chrome::OpenAll(GetWidget()->GetNativeWindow(), page_navigator_, node, |
1299 disposition_from_event_flags, browser_->profile()); | 1299 disposition_from_event_flags, browser_->profile()); |
1300 } | 1300 } |
1301 | 1301 |
1302 RecordBookmarkLaunch(node, GetBookmarkLaunchLocation()); | 1302 RecordBookmarkLaunch(node, GetBookmarkLaunchLocation()); |
1303 } | 1303 } |
1304 | 1304 |
1305 void BookmarkBarView::ShowContextMenuForView(views::View* source, | 1305 void BookmarkBarView::ShowContextMenuForView(views::View* source, |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1974 DCHECK(apps_page_shortcut_); | 1974 DCHECK(apps_page_shortcut_); |
1975 // Only perform layout if required. | 1975 // Only perform layout if required. |
1976 bool visible = chrome::ShouldShowAppsShortcutInBookmarkBar( | 1976 bool visible = chrome::ShouldShowAppsShortcutInBookmarkBar( |
1977 browser_->profile(), browser_->host_desktop_type()); | 1977 browser_->profile(), browser_->host_desktop_type()); |
1978 if (apps_page_shortcut_->visible() == visible) | 1978 if (apps_page_shortcut_->visible() == visible) |
1979 return; | 1979 return; |
1980 apps_page_shortcut_->SetVisible(visible); | 1980 apps_page_shortcut_->SetVisible(visible); |
1981 UpdateBookmarksSeparatorVisibility(); | 1981 UpdateBookmarksSeparatorVisibility(); |
1982 Layout(); | 1982 Layout(); |
1983 } | 1983 } |
OLD | NEW |