| 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/browser_actions_toolbar_gtk.h" | 5 #include "chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 for (ExtensionButtonMap::iterator iter = extension_button_map_.begin(); | 473 for (ExtensionButtonMap::iterator iter = extension_button_map_.begin(); |
| 474 iter != extension_button_map_.end(); ++iter) { | 474 iter != extension_button_map_.end(); ++iter) { |
| 475 iter->second->UpdateState(); | 475 iter->second->UpdateState(); |
| 476 } | 476 } |
| 477 } | 477 } |
| 478 | 478 |
| 479 void BrowserActionsToolbarGtk::Observe(NotificationType type, | 479 void BrowserActionsToolbarGtk::Observe(NotificationType type, |
| 480 const NotificationSource& source, | 480 const NotificationSource& source, |
| 481 const NotificationDetails& details) { | 481 const NotificationDetails& details) { |
| 482 DCHECK(NotificationType::BROWSER_THEME_CHANGED == type); | 482 DCHECK(NotificationType::BROWSER_THEME_CHANGED == type); |
| 483 if (theme_service_->UsingNativeTheme()) | 483 gtk_widget_set_visible(separator_, theme_service_->UsingNativeTheme()); |
| 484 gtk_widget_show(separator_); | |
| 485 else | |
| 486 gtk_widget_hide(separator_); | |
| 487 } | 484 } |
| 488 | 485 |
| 489 void BrowserActionsToolbarGtk::SetupDrags() { | 486 void BrowserActionsToolbarGtk::SetupDrags() { |
| 490 GtkTargetEntry drag_target = GetDragTargetEntry(); | 487 GtkTargetEntry drag_target = GetDragTargetEntry(); |
| 491 gtk_drag_dest_set(button_hbox_.get(), GTK_DEST_DEFAULT_DROP, &drag_target, 1, | 488 gtk_drag_dest_set(button_hbox_.get(), GTK_DEST_DEFAULT_DROP, &drag_target, 1, |
| 492 GDK_ACTION_MOVE); | 489 GDK_ACTION_MOVE); |
| 493 | 490 |
| 494 signals_.Connect(button_hbox_.get(), "drag-motion", | 491 signals_.Connect(button_hbox_.get(), "drag-motion", |
| 495 G_CALLBACK(OnDragMotionThunk), this); | 492 G_CALLBACK(OnDragMotionThunk), this); |
| 496 } | 493 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 } | 556 } |
| 560 | 557 |
| 561 void BrowserActionsToolbarGtk::RemoveButtonForExtension( | 558 void BrowserActionsToolbarGtk::RemoveButtonForExtension( |
| 562 const Extension* extension) { | 559 const Extension* extension) { |
| 563 if (extension_button_map_.erase(extension->id())) | 560 if (extension_button_map_.erase(extension->id())) |
| 564 UpdateVisibility(); | 561 UpdateVisibility(); |
| 565 UpdateChevronVisibility(); | 562 UpdateChevronVisibility(); |
| 566 } | 563 } |
| 567 | 564 |
| 568 void BrowserActionsToolbarGtk::UpdateVisibility() { | 565 void BrowserActionsToolbarGtk::UpdateVisibility() { |
| 569 if (button_count() == 0) | 566 gtk_widget_set_visible(widget(), button_count() != 0); |
| 570 gtk_widget_hide(widget()); | |
| 571 else | |
| 572 gtk_widget_show(widget()); | |
| 573 } | 567 } |
| 574 | 568 |
| 575 bool BrowserActionsToolbarGtk::ShouldDisplayBrowserAction( | 569 bool BrowserActionsToolbarGtk::ShouldDisplayBrowserAction( |
| 576 const Extension* extension) { | 570 const Extension* extension) { |
| 577 // Only display incognito-enabled extensions while in incognito mode. | 571 // Only display incognito-enabled extensions while in incognito mode. |
| 578 return (!profile_->IsOffTheRecord() || | 572 return (!profile_->IsOffTheRecord() || |
| 579 profile_->GetExtensionService()->IsIncognitoEnabled(extension->id())); | 573 profile_->GetExtensionService()->IsIncognitoEnabled(extension->id())); |
| 580 } | 574 } |
| 581 | 575 |
| 582 void BrowserActionsToolbarGtk::HidePopup() { | 576 void BrowserActionsToolbarGtk::HidePopup() { |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 | 950 |
| 957 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root), | 951 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root), |
| 958 event->time); | 952 event->time); |
| 959 return TRUE; | 953 return TRUE; |
| 960 } | 954 } |
| 961 | 955 |
| 962 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) { | 956 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) { |
| 963 if (!resize_animation_.is_animating()) | 957 if (!resize_animation_.is_animating()) |
| 964 UpdateChevronVisibility(); | 958 UpdateChevronVisibility(); |
| 965 } | 959 } |
| OLD | NEW |