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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <limits> | 10 #include <limits> |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 } | 232 } |
233 | 233 |
234 bool IsTriggerableEvent(const ui::Event& e) override { | 234 bool IsTriggerableEvent(const ui::Event& e) override { |
235 return e.type() == ui::ET_GESTURE_TAP || | 235 return e.type() == ui::ET_GESTURE_TAP || |
236 e.type() == ui::ET_GESTURE_TAP_DOWN || | 236 e.type() == ui::ET_GESTURE_TAP_DOWN || |
237 event_utils::IsPossibleDispositionEvent(e); | 237 event_utils::IsPossibleDispositionEvent(e); |
238 } | 238 } |
239 | 239 |
240 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override { | 240 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override { |
241 return base::WrapUnique(new views::FloodFillInkDropRipple( | 241 return base::WrapUnique(new views::FloodFillInkDropRipple( |
242 CalculateInkDropBounds(size()), GetInkDropCenter(), | 242 CalculateInkDropBounds(size()), GetInkDropCenterBasedOnLastEvent(), |
243 GetInkDropBaseColor())); | 243 GetInkDropBaseColor())); |
244 } | 244 } |
245 | 245 |
246 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() | 246 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() |
247 const override { | 247 const override { |
248 if (!ShouldShowInkDropHighlight()) | 248 if (!ShouldShowInkDropHighlight()) |
249 return nullptr; | 249 return nullptr; |
250 | 250 |
251 const gfx::Rect bounds = CalculateInkDropBounds(size()); | 251 const gfx::Rect bounds = CalculateInkDropBounds(size()); |
252 return base::WrapUnique(new views::InkDropHighlight( | 252 return base::WrapUnique(new views::InkDropHighlight( |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 public: | 329 public: |
330 BookmarkMenuButtonBase(const base::string16& title, | 330 BookmarkMenuButtonBase(const base::string16& title, |
331 views::MenuButtonListener* menu_button_listener, | 331 views::MenuButtonListener* menu_button_listener, |
332 bool show_menu_marker) | 332 bool show_menu_marker) |
333 : MenuButton(title, menu_button_listener, show_menu_marker) { | 333 : MenuButton(title, menu_button_listener, show_menu_marker) { |
334 SetHasInkDrop(true); | 334 SetHasInkDrop(true); |
335 } | 335 } |
336 | 336 |
337 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override { | 337 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override { |
338 return base::WrapUnique(new views::FloodFillInkDropRipple( | 338 return base::WrapUnique(new views::FloodFillInkDropRipple( |
339 CalculateInkDropBounds(size()), GetInkDropCenter(), | 339 CalculateInkDropBounds(size()), GetInkDropCenterBasedOnLastEvent(), |
340 GetInkDropBaseColor())); | 340 GetInkDropBaseColor())); |
341 } | 341 } |
342 | 342 |
343 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() | 343 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() |
344 const override { | 344 const override { |
345 if (!ShouldShowInkDropHighlight()) | 345 if (!ShouldShowInkDropHighlight()) |
346 return nullptr; | 346 return nullptr; |
347 | 347 |
348 const gfx::Rect bounds = CalculateInkDropBounds(size()); | 348 const gfx::Rect bounds = CalculateInkDropBounds(size()); |
349 return base::WrapUnique(new views::InkDropHighlight( | 349 return base::WrapUnique(new views::InkDropHighlight( |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 if (label()->GetPreferredSize().width() > label()->size().width()) | 385 if (label()->GetPreferredSize().width() > label()->size().width()) |
386 *tooltip = GetText(); | 386 *tooltip = GetText(); |
387 return !tooltip->empty(); | 387 return !tooltip->empty(); |
388 } | 388 } |
389 | 389 |
390 bool OnMousePressed(const ui::MouseEvent& event) override { | 390 bool OnMousePressed(const ui::MouseEvent& event) override { |
391 if (event.IsOnlyLeftMouseButton()) { | 391 if (event.IsOnlyLeftMouseButton()) { |
392 // TODO(bruthig): The ACTION_PENDING triggering logic should be in | 392 // TODO(bruthig): The ACTION_PENDING triggering logic should be in |
393 // MenuButton::OnPressed() however there is a bug with the pressed state | 393 // MenuButton::OnPressed() however there is a bug with the pressed state |
394 // logic in MenuButton. See http://crbug.com/567252. | 394 // logic in MenuButton. See http://crbug.com/567252. |
395 AnimateInkDrop(views::InkDropState::ACTION_PENDING); | 395 AnimateInkDrop(views::InkDropState::ACTION_PENDING, &event); |
396 } | 396 } |
397 return MenuButton::OnMousePressed(event); | 397 return MenuButton::OnMousePressed(event); |
398 } | 398 } |
399 | 399 |
400 bool IsTriggerableEventType(const ui::Event& e) override { | 400 bool IsTriggerableEventType(const ui::Event& e) override { |
401 // Bookmark folders handle normal menu button events (i.e., left click) as | 401 // Bookmark folders handle normal menu button events (i.e., left click) as |
402 // well as clicks to open bookmarks in new tabs that would otherwise be | 402 // well as clicks to open bookmarks in new tabs that would otherwise be |
403 // ignored. | 403 // ignored. |
404 return BookmarkMenuButtonBase::IsTriggerableEventType(e) || | 404 return BookmarkMenuButtonBase::IsTriggerableEventType(e) || |
405 (e.IsMouseEvent() && | 405 (e.IsMouseEvent() && |
(...skipping 1748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2154 return; | 2154 return; |
2155 apps_page_shortcut_->SetVisible(visible); | 2155 apps_page_shortcut_->SetVisible(visible); |
2156 UpdateBookmarksSeparatorVisibility(); | 2156 UpdateBookmarksSeparatorVisibility(); |
2157 LayoutAndPaint(); | 2157 LayoutAndPaint(); |
2158 } | 2158 } |
2159 | 2159 |
2160 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { | 2160 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { |
2161 if (UpdateOtherAndManagedButtonsVisibility()) | 2161 if (UpdateOtherAndManagedButtonsVisibility()) |
2162 LayoutAndPaint(); | 2162 LayoutAndPaint(); |
2163 } | 2163 } |
OLD | NEW |