OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 AnimationProgressed(&slide_animation_); | 419 AnimationProgressed(&slide_animation_); |
420 } | 420 } |
421 | 421 |
422 if (model_ && model_->IsLoaded()) | 422 if (model_ && model_->IsLoaded()) |
423 UpdateOtherBookmarksVisibility(); | 423 UpdateOtherBookmarksVisibility(); |
424 | 424 |
425 // Hide out behind the findbar. This is rather fragile code, it could | 425 // Hide out behind the findbar. This is rather fragile code, it could |
426 // probably be improved. | 426 // probably be improved. |
427 if (bookmark_bar_state_ == BookmarkBar::DETACHED) { | 427 if (bookmark_bar_state_ == BookmarkBar::DETACHED) { |
428 if (theme_service_->UsingNativeTheme()) { | 428 if (theme_service_->UsingNativeTheme()) { |
429 if (GTK_WIDGET_REALIZED(event_box_->parent)) | 429 if (gtk_widget_get_realized(event_box_->parent)) |
430 gdk_window_lower(event_box_->parent->window); | 430 gdk_window_lower(event_box_->parent->window); |
431 if (GTK_WIDGET_REALIZED(event_box_.get())) | 431 if (gtk_widget_get_realized(event_box_.get())) |
432 gdk_window_lower(event_box_->window); | 432 gdk_window_lower(event_box_->window); |
433 } else { // Chromium theme mode. | 433 } else { // Chromium theme mode. |
434 if (GTK_WIDGET_REALIZED(paint_box_)) { | 434 if (gtk_widget_get_realized(paint_box_)) { |
435 gdk_window_lower(paint_box_->window); | 435 gdk_window_lower(paint_box_->window); |
436 // The event box won't stay below its children's GdkWindows unless we | 436 // The event box won't stay below its children's GdkWindows unless we |
437 // toggle the above-child property here. If the event box doesn't stay | 437 // toggle the above-child property here. If the event box doesn't stay |
438 // below its children then events will be routed to it rather than the | 438 // below its children then events will be routed to it rather than the |
439 // children. | 439 // children. |
440 gtk_event_box_set_above_child(GTK_EVENT_BOX(event_box_.get()), TRUE); | 440 gtk_event_box_set_above_child(GTK_EVENT_BOX(event_box_.get()), TRUE); |
441 gtk_event_box_set_above_child(GTK_EVENT_BOX(event_box_.get()), FALSE); | 441 gtk_event_box_set_above_child(GTK_EVENT_BOX(event_box_.get()), FALSE); |
442 } | 442 } |
443 } | 443 } |
444 } | 444 } |
(...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1388 cairo_destroy(cr); | 1388 cairo_destroy(cr); |
1389 } else { | 1389 } else { |
1390 gfx::Size tab_contents_size; | 1390 gfx::Size tab_contents_size; |
1391 if (!GetTabContentsSize(&tab_contents_size)) | 1391 if (!GetTabContentsSize(&tab_contents_size)) |
1392 return FALSE; | 1392 return FALSE; |
1393 gfx::CanvasSkiaPaint canvas(event, true); | 1393 gfx::CanvasSkiaPaint canvas(event, true); |
1394 | 1394 |
1395 GtkAllocation allocation; | 1395 GtkAllocation allocation; |
1396 gtk_widget_get_allocation(widget, &allocation); | 1396 gtk_widget_get_allocation(widget, &allocation); |
1397 | 1397 |
1398 gfx::Rect area = GTK_WIDGET_NO_WINDOW(widget) ? | 1398 gfx::Rect area = gtk_widget_get_has_window(widget) ? |
1399 gfx::Rect(allocation) : | 1399 gfx::Rect(0, 0, allocation.width, allocation.height) : |
1400 gfx::Rect(0, 0, allocation.width, allocation.height); | 1400 gfx::Rect(allocation); |
1401 NtpBackgroundUtil::PaintBackgroundDetachedMode(theme_provider, &canvas, | 1401 NtpBackgroundUtil::PaintBackgroundDetachedMode(theme_provider, &canvas, |
1402 area, tab_contents_size.height()); | 1402 area, tab_contents_size.height()); |
1403 } | 1403 } |
1404 | 1404 |
1405 return FALSE; // Propagate expose to children. | 1405 return FALSE; // Propagate expose to children. |
1406 } | 1406 } |
1407 | 1407 |
1408 void BookmarkBarGtk::OnEventBoxDestroy(GtkWidget* widget) { | 1408 void BookmarkBarGtk::OnEventBoxDestroy(GtkWidget* widget) { |
1409 if (model_) | 1409 if (model_) |
1410 model_->RemoveObserver(this); | 1410 model_->RemoveObserver(this); |
(...skipping 24 matching lines...) Expand all Loading... |
1435 void BookmarkBarGtk::OnEditBookmarksEnabledChanged() { | 1435 void BookmarkBarGtk::OnEditBookmarksEnabledChanged() { |
1436 GtkDestDefaults dest_defaults = | 1436 GtkDestDefaults dest_defaults = |
1437 *edit_bookmarks_enabled_ ? GTK_DEST_DEFAULT_ALL : | 1437 *edit_bookmarks_enabled_ ? GTK_DEST_DEFAULT_ALL : |
1438 GTK_DEST_DEFAULT_DROP; | 1438 GTK_DEST_DEFAULT_DROP; |
1439 gtk_drag_dest_set(overflow_button_, dest_defaults, NULL, 0, kDragAction); | 1439 gtk_drag_dest_set(overflow_button_, dest_defaults, NULL, 0, kDragAction); |
1440 gtk_drag_dest_set(other_bookmarks_button_, dest_defaults, | 1440 gtk_drag_dest_set(other_bookmarks_button_, dest_defaults, |
1441 NULL, 0, kDragAction); | 1441 NULL, 0, kDragAction); |
1442 ui::SetDestTargetList(overflow_button_, kDestTargetList); | 1442 ui::SetDestTargetList(overflow_button_, kDestTargetList); |
1443 ui::SetDestTargetList(other_bookmarks_button_, kDestTargetList); | 1443 ui::SetDestTargetList(other_bookmarks_button_, kDestTargetList); |
1444 } | 1444 } |
OLD | NEW |