| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/gfx/gtk_util.h" | 9 #include "app/gfx/gtk_util.h" |
| 10 #include "app/gfx/canvas_paint.h" | 10 #include "app/gfx/canvas_paint.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 Profile* profile, Browser* browser, | 111 Profile* profile, Browser* browser, |
| 112 TabstripOriginProvider* tabstrip_origin_provider) | 112 TabstripOriginProvider* tabstrip_origin_provider) |
| 113 : profile_(NULL), | 113 : profile_(NULL), |
| 114 page_navigator_(NULL), | 114 page_navigator_(NULL), |
| 115 browser_(browser), | 115 browser_(browser), |
| 116 window_(window), | 116 window_(window), |
| 117 tabstrip_origin_provider_(tabstrip_origin_provider), | 117 tabstrip_origin_provider_(tabstrip_origin_provider), |
| 118 model_(NULL), | 118 model_(NULL), |
| 119 instructions_label_(NULL), | 119 instructions_label_(NULL), |
| 120 instructions_(NULL), | 120 instructions_(NULL), |
| 121 sync_error_button_(NULL), | |
| 122 sync_service_(NULL), | 121 sync_service_(NULL), |
| 123 dragged_node_(NULL), | 122 dragged_node_(NULL), |
| 124 toolbar_drop_item_(NULL), | 123 toolbar_drop_item_(NULL), |
| 125 theme_provider_(GtkThemeProvider::GetFrom(profile)), | 124 theme_provider_(GtkThemeProvider::GetFrom(profile)), |
| 126 show_instructions_(true), | 125 show_instructions_(true), |
| 127 menu_bar_helper_(this), | 126 menu_bar_helper_(this), |
| 128 floating_(false), | 127 floating_(false), |
| 129 last_allocation_width_(-1), | 128 last_allocation_width_(-1), |
| 130 event_box_paint_factory_(this) { | 129 event_box_paint_factory_(this) { |
| 131 if (profile->GetProfileSyncService()) { | 130 if (profile->GetProfileSyncService()) { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 G_CALLBACK(&OnToolbarDragLeave), this); | 253 G_CALLBACK(&OnToolbarDragLeave), this); |
| 255 g_signal_connect(bookmark_toolbar_.get(), "drag-data-received", | 254 g_signal_connect(bookmark_toolbar_.get(), "drag-data-received", |
| 256 G_CALLBACK(&OnDragReceived), this); | 255 G_CALLBACK(&OnDragReceived), this); |
| 257 | 256 |
| 258 GtkWidget* vseparator = gtk_vseparator_new(); | 257 GtkWidget* vseparator = gtk_vseparator_new(); |
| 259 gtk_box_pack_start(GTK_BOX(bookmark_hbox_), vseparator, | 258 gtk_box_pack_start(GTK_BOX(bookmark_hbox_), vseparator, |
| 260 FALSE, FALSE, 0); | 259 FALSE, FALSE, 0); |
| 261 g_signal_connect(vseparator, "expose-event", | 260 g_signal_connect(vseparator, "expose-event", |
| 262 G_CALLBACK(OnSeparatorExpose), this); | 261 G_CALLBACK(OnSeparatorExpose), this); |
| 263 | 262 |
| 264 sync_error_button_ = theme_provider_->BuildChromeButton(); | |
| 265 ConnectFolderButtonEvents(sync_error_button_); | |
| 266 gtk_box_pack_start(GTK_BOX(bookmark_hbox_), sync_error_button_, | |
| 267 FALSE, FALSE, 0); | |
| 268 | |
| 269 // We pack the button manually (rather than using gtk_button_set_*) so that | 263 // We pack the button manually (rather than using gtk_button_set_*) so that |
| 270 // we can have finer control over its label. | 264 // we can have finer control over its label. |
| 271 other_bookmarks_button_ = theme_provider_->BuildChromeButton(); | 265 other_bookmarks_button_ = theme_provider_->BuildChromeButton(); |
| 272 ConnectFolderButtonEvents(other_bookmarks_button_); | 266 ConnectFolderButtonEvents(other_bookmarks_button_); |
| 273 gtk_box_pack_start(GTK_BOX(bookmark_hbox_), other_bookmarks_button_, | 267 gtk_box_pack_start(GTK_BOX(bookmark_hbox_), other_bookmarks_button_, |
| 274 FALSE, FALSE, 0); | 268 FALSE, FALSE, 0); |
| 275 | 269 |
| 276 gtk_widget_set_size_request(event_box_.get(), -1, kBookmarkBarMinimumHeight); | 270 gtk_widget_set_size_request(event_box_.get(), -1, kBookmarkBarMinimumHeight); |
| 277 | 271 |
| 278 slide_animation_.reset(new SlideAnimation(this)); | 272 slide_animation_.reset(new SlideAnimation(this)); |
| (...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1257 break; | 1251 break; |
| 1258 } | 1252 } |
| 1259 } | 1253 } |
| 1260 DCHECK_NE(button_idx, -1); | 1254 DCHECK_NE(button_idx, -1); |
| 1261 | 1255 |
| 1262 // Find the GtkWidget* for the actual target button. | 1256 // Find the GtkWidget* for the actual target button. |
| 1263 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; | 1257 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; |
| 1264 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); | 1258 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); |
| 1265 PopupForButton(folder_list[button_idx]); | 1259 PopupForButton(folder_list[button_idx]); |
| 1266 } | 1260 } |
| OLD | NEW |