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

Side by Side Diff: chrome/browser/gtk/bookmark_bar_gtk.cc

Issue 6154001: Move animation code to new ui/base/animation directory.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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
« no previous file with comments | « chrome/browser/gtk/bookmark_bar_gtk.h ('k') | chrome/browser/gtk/browser_actions_toolbar_gtk.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/gtk/bookmark_bar_gtk.h" 5 #include "chrome/browser/gtk/bookmark_bar_gtk.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "app/gtk_dnd_util.h" 9 #include "app/gtk_dnd_util.h"
10 #include "app/slide_animation.h"
11 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
12 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/bookmarks/bookmark_node_data.h" 12 #include "chrome/browser/bookmarks/bookmark_node_data.h"
14 #include "chrome/browser/bookmarks/bookmark_model.h" 13 #include "chrome/browser/bookmarks/bookmark_model.h"
15 #include "chrome/browser/bookmarks/bookmark_utils.h" 14 #include "chrome/browser/bookmarks/bookmark_utils.h"
16 #include "chrome/browser/browser_shutdown.h" 15 #include "chrome/browser/browser_shutdown.h"
17 #include "chrome/browser/gtk/bookmark_menu_controller_gtk.h" 16 #include "chrome/browser/gtk/bookmark_menu_controller_gtk.h"
18 #include "chrome/browser/gtk/bookmark_tree_model.h" 17 #include "chrome/browser/gtk/bookmark_tree_model.h"
19 #include "chrome/browser/gtk/bookmark_utils_gtk.h" 18 #include "chrome/browser/gtk/bookmark_utils_gtk.h"
20 #include "chrome/browser/gtk/browser_window_gtk.h" 19 #include "chrome/browser/gtk/browser_window_gtk.h"
(...skipping 18 matching lines...) Expand all
39 #include "chrome/browser/tab_contents/tab_contents.h" 38 #include "chrome/browser/tab_contents/tab_contents.h"
40 #include "chrome/browser/tab_contents/tab_contents_view.h" 39 #include "chrome/browser/tab_contents/tab_contents_view.h"
41 #include "chrome/browser/ui/browser.h" 40 #include "chrome/browser/ui/browser.h"
42 #include "chrome/common/notification_service.h" 41 #include "chrome/common/notification_service.h"
43 #include "chrome/common/pref_names.h" 42 #include "chrome/common/pref_names.h"
44 #include "gfx/canvas_skia_paint.h" 43 #include "gfx/canvas_skia_paint.h"
45 #include "gfx/gtk_util.h" 44 #include "gfx/gtk_util.h"
46 #include "grit/app_resources.h" 45 #include "grit/app_resources.h"
47 #include "grit/generated_resources.h" 46 #include "grit/generated_resources.h"
48 #include "grit/theme_resources.h" 47 #include "grit/theme_resources.h"
48 #include "ui/base/animation/slide_animation.h"
49 49
50 namespace { 50 namespace {
51 51
52 // The showing height of the bar. 52 // The showing height of the bar.
53 const int kBookmarkBarHeight = 29; 53 const int kBookmarkBarHeight = 29;
54 54
55 // Padding for when the bookmark bar is floating. 55 // Padding for when the bookmark bar is floating.
56 const int kTopBottomNTPPadding = 12; 56 const int kTopBottomNTPPadding = 12;
57 const int kLeftRightNTPPadding = 8; 57 const int kLeftRightNTPPadding = 8;
58 58
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 GTK_BUTTON(sync_error_button_), 270 GTK_BUTTON(sync_error_button_),
271 gtk_image_new_from_pixbuf( 271 gtk_image_new_from_pixbuf(
272 ResourceBundle::GetSharedInstance().GetPixbufNamed(IDR_WARNING))); 272 ResourceBundle::GetSharedInstance().GetPixbufNamed(IDR_WARNING)));
273 g_signal_connect(sync_error_button_, "button-press-event", 273 g_signal_connect(sync_error_button_, "button-press-event",
274 G_CALLBACK(OnSyncErrorButtonPressedThunk), this); 274 G_CALLBACK(OnSyncErrorButtonPressedThunk), this);
275 gtk_box_pack_start(GTK_BOX(bookmark_hbox_), sync_error_button_, 275 gtk_box_pack_start(GTK_BOX(bookmark_hbox_), sync_error_button_,
276 FALSE, FALSE, 0); 276 FALSE, FALSE, 0);
277 277
278 gtk_widget_set_size_request(event_box_.get(), -1, kBookmarkBarMinimumHeight); 278 gtk_widget_set_size_request(event_box_.get(), -1, kBookmarkBarMinimumHeight);
279 279
280 slide_animation_.reset(new SlideAnimation(this)); 280 slide_animation_.reset(new ui::SlideAnimation(this));
281 281
282 ViewIDUtil::SetID(other_bookmarks_button_, VIEW_ID_OTHER_BOOKMARKS); 282 ViewIDUtil::SetID(other_bookmarks_button_, VIEW_ID_OTHER_BOOKMARKS);
283 ViewIDUtil::SetID(widget(), VIEW_ID_BOOKMARK_BAR); 283 ViewIDUtil::SetID(widget(), VIEW_ID_BOOKMARK_BAR);
284 284
285 gtk_widget_show_all(widget()); 285 gtk_widget_show_all(widget());
286 gtk_widget_hide(widget()); 286 gtk_widget_hide(widget());
287 } 287 }
288 288
289 void BookmarkBarGtk::Show(bool animate) { 289 void BookmarkBarGtk::Show(bool animate) {
290 gtk_widget_show_all(widget()); 290 gtk_widget_show_all(widget());
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 HoverControllerGtk::GetHoverControllerGtk(throbbing_widget_); 765 HoverControllerGtk::GetHoverControllerGtk(throbbing_widget_);
766 if (hover_controller) 766 if (hover_controller)
767 hover_controller->StartThrobbing(4); 767 hover_controller->StartThrobbing(4);
768 } 768 }
769 } 769 }
770 770
771 bool BookmarkBarGtk::IsAlwaysShown() { 771 bool BookmarkBarGtk::IsAlwaysShown() {
772 return profile_->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar); 772 return profile_->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar);
773 } 773 }
774 774
775 void BookmarkBarGtk::AnimationProgressed(const Animation* animation) { 775 void BookmarkBarGtk::AnimationProgressed(const ui::Animation* animation) {
776 DCHECK_EQ(animation, slide_animation_.get()); 776 DCHECK_EQ(animation, slide_animation_.get());
777 777
778 int max_height = ShouldBeFloating() ? 778 int max_height = ShouldBeFloating() ?
779 kBookmarkBarNTPHeight : kBookmarkBarHeight; 779 kBookmarkBarNTPHeight : kBookmarkBarHeight;
780 gint height = 780 gint height =
781 static_cast<gint>(animation->GetCurrentValue() * 781 static_cast<gint>(animation->GetCurrentValue() *
782 (max_height - kBookmarkBarMinimumHeight)) + 782 (max_height - kBookmarkBarMinimumHeight)) +
783 kBookmarkBarMinimumHeight; 783 kBookmarkBarMinimumHeight;
784 gtk_widget_set_size_request(event_box_.get(), -1, height); 784 gtk_widget_set_size_request(event_box_.get(), -1, height);
785 } 785 }
786 786
787 void BookmarkBarGtk::AnimationEnded(const Animation* animation) { 787 void BookmarkBarGtk::AnimationEnded(const ui::Animation* animation) {
788 DCHECK_EQ(animation, slide_animation_.get()); 788 DCHECK_EQ(animation, slide_animation_.get());
789 789
790 if (!slide_animation_->IsShowing()) { 790 if (!slide_animation_->IsShowing()) {
791 gtk_widget_hide(bookmark_hbox_); 791 gtk_widget_hide(bookmark_hbox_);
792 792
793 // We can be windowless during unit tests. 793 // We can be windowless during unit tests.
794 if (window_) { 794 if (window_) {
795 // Because of our constant resizing and our toolbar/bookmark bar overlap 795 // Because of our constant resizing and our toolbar/bookmark bar overlap
796 // shenanigans, gtk+ gets confused, partially draws parts of the bookmark 796 // shenanigans, gtk+ gets confused, partially draws parts of the bookmark
797 // bar into the toolbar and than doesn't queue a redraw to fix it. So do 797 // bar into the toolbar and than doesn't queue a redraw to fix it. So do
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
1409 1409
1410 // Find the GtkWidget* for the actual target button. 1410 // Find the GtkWidget* for the actual target button.
1411 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; 1411 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1;
1412 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); 1412 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size();
1413 PopupForButton(folder_list[button_idx]); 1413 PopupForButton(folder_list[button_idx]);
1414 } 1414 }
1415 1415
1416 void BookmarkBarGtk::CloseMenu() { 1416 void BookmarkBarGtk::CloseMenu() {
1417 current_context_menu_->Cancel(); 1417 current_context_menu_->Cancel();
1418 } 1418 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/bookmark_bar_gtk.h ('k') | chrome/browser/gtk/browser_actions_toolbar_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698