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/gtk/bookmarks/bookmark_bar_gtk.h" | 5 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 // because the event box probably already has a size request. | 345 // because the event box probably already has a size request. |
346 GtkRequisition req; | 346 GtkRequisition req; |
347 gtk_widget_size_request(ntp_padding_box_, &req); | 347 gtk_widget_size_request(ntp_padding_box_, &req); |
348 max_height_ = req.height; | 348 max_height_ = req.height; |
349 } else { | 349 } else { |
350 max_height_ = (bookmark_bar_state_ == BookmarkBar::DETACHED) ? | 350 max_height_ = (bookmark_bar_state_ == BookmarkBar::DETACHED) ? |
351 chrome::kNTPBookmarkBarHeight : chrome::kBookmarkBarHeight; | 351 chrome::kNTPBookmarkBarHeight : chrome::kBookmarkBarHeight; |
352 } | 352 } |
353 } | 353 } |
354 | 354 |
355 void BookmarkBarGtk::AnimationProgressed(const ui::Animation* animation) { | 355 void BookmarkBarGtk::AnimationProgressed(const gfx::Animation* animation) { |
356 DCHECK_EQ(animation, &slide_animation_); | 356 DCHECK_EQ(animation, &slide_animation_); |
357 | 357 |
358 gint height = | 358 gint height = |
359 static_cast<gint>(animation->GetCurrentValue() * | 359 static_cast<gint>(animation->GetCurrentValue() * |
360 (max_height_ - kBookmarkBarMinimumHeight)) + | 360 (max_height_ - kBookmarkBarMinimumHeight)) + |
361 kBookmarkBarMinimumHeight; | 361 kBookmarkBarMinimumHeight; |
362 gtk_widget_set_size_request(event_box_.get(), -1, height); | 362 gtk_widget_set_size_request(event_box_.get(), -1, height); |
363 } | 363 } |
364 | 364 |
365 void BookmarkBarGtk::AnimationEnded(const ui::Animation* animation) { | 365 void BookmarkBarGtk::AnimationEnded(const gfx::Animation* animation) { |
366 DCHECK_EQ(animation, &slide_animation_); | 366 DCHECK_EQ(animation, &slide_animation_); |
367 | 367 |
368 if (!slide_animation_.IsShowing()) { | 368 if (!slide_animation_.IsShowing()) { |
369 gtk_widget_hide(bookmark_hbox_); | 369 gtk_widget_hide(bookmark_hbox_); |
370 | 370 |
371 // We can be windowless during unit tests. | 371 // We can be windowless during unit tests. |
372 if (window_) { | 372 if (window_) { |
373 // Because of our constant resizing and our toolbar/bookmark bar overlap | 373 // Because of our constant resizing and our toolbar/bookmark bar overlap |
374 // shenanigans, gtk+ gets confused, partially draws parts of the bookmark | 374 // shenanigans, gtk+ gets confused, partially draws parts of the bookmark |
375 // bar into the toolbar and than doesn't queue a redraw to fix it. So do | 375 // bar into the toolbar and than doesn't queue a redraw to fix it. So do |
(...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1509 void BookmarkBarGtk::OnEditBookmarksEnabledChanged() { | 1509 void BookmarkBarGtk::OnEditBookmarksEnabledChanged() { |
1510 GtkDestDefaults dest_defaults = | 1510 GtkDestDefaults dest_defaults = |
1511 *edit_bookmarks_enabled_ ? GTK_DEST_DEFAULT_ALL : | 1511 *edit_bookmarks_enabled_ ? GTK_DEST_DEFAULT_ALL : |
1512 GTK_DEST_DEFAULT_DROP; | 1512 GTK_DEST_DEFAULT_DROP; |
1513 gtk_drag_dest_set(overflow_button_, dest_defaults, NULL, 0, kDragAction); | 1513 gtk_drag_dest_set(overflow_button_, dest_defaults, NULL, 0, kDragAction); |
1514 gtk_drag_dest_set(other_bookmarks_button_, dest_defaults, | 1514 gtk_drag_dest_set(other_bookmarks_button_, dest_defaults, |
1515 NULL, 0, kDragAction); | 1515 NULL, 0, kDragAction); |
1516 ui::SetDestTargetList(overflow_button_, kDestTargetList); | 1516 ui::SetDestTargetList(overflow_button_, kDestTargetList); |
1517 ui::SetDestTargetList(other_bookmarks_button_, kDestTargetList); | 1517 ui::SetDestTargetList(other_bookmarks_button_, kDestTargetList); |
1518 } | 1518 } |
OLD | NEW |