| 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 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 gtk_widget_modify_bg(paint_box_, GTK_STATE_NORMAL, &paint_box_color); | 973 gtk_widget_modify_bg(paint_box_, GTK_STATE_NORMAL, &paint_box_color); |
| 974 | 974 |
| 975 if (bookmark_bar_state_ == BookmarkBar::DETACHED) { | 975 if (bookmark_bar_state_ == BookmarkBar::DETACHED) { |
| 976 GdkColor stroke_color = theme_service_->UsingNativeTheme() ? | 976 GdkColor stroke_color = theme_service_->UsingNativeTheme() ? |
| 977 theme_service_->GetBorderColor() : | 977 theme_service_->GetBorderColor() : |
| 978 theme_service_->GetGdkColor(ThemeService::COLOR_NTP_HEADER); | 978 theme_service_->GetGdkColor(ThemeService::COLOR_NTP_HEADER); |
| 979 gtk_util::SetRoundedWindowBorderColor(paint_box_, stroke_color); | 979 gtk_util::SetRoundedWindowBorderColor(paint_box_, stroke_color); |
| 980 } | 980 } |
| 981 | 981 |
| 982 SetOverflowButtonAppearance(); | 982 SetOverflowButtonAppearance(); |
| 983 } else if (type == chrome::NOTIFICATION_PREF_CHANGED) { | |
| 984 const std::string& pref_name = | |
| 985 *content::Details<std::string>(details).ptr(); | |
| 986 if (pref_name == prefs::kEditBookmarksEnabled) | |
| 987 OnEditBookmarksEnabledChanged(); | |
| 988 } | 983 } |
| 989 } | 984 } |
| 990 | 985 |
| 986 void BookmarkBarGtk::OnPreferenceChanged(PrefServiceBase* service, |
| 987 const std::string& pref_name) { |
| 988 if (pref_name == prefs::kEditBookmarksEnabled) |
| 989 OnEditBookmarksEnabledChanged(); |
| 990 } |
| 991 |
| 991 GtkWidget* BookmarkBarGtk::CreateBookmarkButton(const BookmarkNode* node) { | 992 GtkWidget* BookmarkBarGtk::CreateBookmarkButton(const BookmarkNode* node) { |
| 992 GtkWidget* button = theme_service_->BuildChromeButton(); | 993 GtkWidget* button = theme_service_->BuildChromeButton(); |
| 993 bookmark_utils::ConfigureButtonForNode(node, model_, button, theme_service_); | 994 bookmark_utils::ConfigureButtonForNode(node, model_, button, theme_service_); |
| 994 | 995 |
| 995 // The tool item is also a source for dragging | 996 // The tool item is also a source for dragging |
| 996 gtk_drag_source_set(button, GDK_BUTTON1_MASK, NULL, 0, | 997 gtk_drag_source_set(button, GDK_BUTTON1_MASK, NULL, 0, |
| 997 static_cast<GdkDragAction>(GDK_ACTION_MOVE | GDK_ACTION_COPY)); | 998 static_cast<GdkDragAction>(GDK_ACTION_MOVE | GDK_ACTION_COPY)); |
| 998 int target_mask = bookmark_utils::GetCodeMask(node->is_folder()); | 999 int target_mask = bookmark_utils::GetCodeMask(node->is_folder()); |
| 999 ui::SetSourceTargetListFromCodeMask(button, target_mask); | 1000 ui::SetSourceTargetListFromCodeMask(button, target_mask); |
| 1000 g_signal_connect(button, "drag-begin", | 1001 g_signal_connect(button, "drag-begin", |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1457 void BookmarkBarGtk::OnEditBookmarksEnabledChanged() { | 1458 void BookmarkBarGtk::OnEditBookmarksEnabledChanged() { |
| 1458 GtkDestDefaults dest_defaults = | 1459 GtkDestDefaults dest_defaults = |
| 1459 *edit_bookmarks_enabled_ ? GTK_DEST_DEFAULT_ALL : | 1460 *edit_bookmarks_enabled_ ? GTK_DEST_DEFAULT_ALL : |
| 1460 GTK_DEST_DEFAULT_DROP; | 1461 GTK_DEST_DEFAULT_DROP; |
| 1461 gtk_drag_dest_set(overflow_button_, dest_defaults, NULL, 0, kDragAction); | 1462 gtk_drag_dest_set(overflow_button_, dest_defaults, NULL, 0, kDragAction); |
| 1462 gtk_drag_dest_set(other_bookmarks_button_, dest_defaults, | 1463 gtk_drag_dest_set(other_bookmarks_button_, dest_defaults, |
| 1463 NULL, 0, kDragAction); | 1464 NULL, 0, kDragAction); |
| 1464 ui::SetDestTargetList(overflow_button_, kDestTargetList); | 1465 ui::SetDestTargetList(overflow_button_, kDestTargetList); |
| 1465 ui::SetDestTargetList(other_bookmarks_button_, kDestTargetList); | 1466 ui::SetDestTargetList(other_bookmarks_button_, kDestTargetList); |
| 1466 } | 1467 } |
| OLD | NEW |