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

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

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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
OLDNEW
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/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 sync_service_->AddObserver(this); 149 sync_service_->AddObserver(this);
150 } 150 }
151 151
152 Init(profile); 152 Init(profile);
153 SetProfile(profile); 153 SetProfile(profile);
154 // Force an update by simulating being in the wrong state. 154 // Force an update by simulating being in the wrong state.
155 // BrowserWindowGtk sets our true state after we're created. 155 // BrowserWindowGtk sets our true state after we're created.
156 SetBookmarkBarState(BookmarkBar::SHOW, 156 SetBookmarkBarState(BookmarkBar::SHOW,
157 BookmarkBar::DONT_ANIMATE_STATE_CHANGE); 157 BookmarkBar::DONT_ANIMATE_STATE_CHANGE);
158 158
159 registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, 159 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
160 Source<ThemeService>(theme_service_)); 160 Source<ThemeService>(theme_service_));
161 161
162 edit_bookmarks_enabled_.Init(prefs::kEditBookmarksEnabled, 162 edit_bookmarks_enabled_.Init(prefs::kEditBookmarksEnabled,
163 profile_->GetPrefs(), this); 163 profile_->GetPrefs(), this);
164 OnEditBookmarksEnabledChanged(); 164 OnEditBookmarksEnabledChanged();
165 } 165 }
166 166
167 BookmarkBarGtk::~BookmarkBarGtk() { 167 BookmarkBarGtk::~BookmarkBarGtk() {
168 RemoveAllBookmarkButtons(); 168 RemoveAllBookmarkButtons();
169 bookmark_toolbar_.Destroy(); 169 bookmark_toolbar_.Destroy();
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 void BookmarkBarGtk::BookmarkNodeChildrenReordered(BookmarkModel* model, 922 void BookmarkBarGtk::BookmarkNodeChildrenReordered(BookmarkModel* model,
923 const BookmarkNode* node) { 923 const BookmarkNode* node) {
924 if (node != model_->GetBookmarkBarNode()) 924 if (node != model_->GetBookmarkBarNode())
925 return; // We only care about reordering of the bookmark bar node. 925 return; // We only care about reordering of the bookmark bar node.
926 926
927 // Purge and rebuild the bar. 927 // Purge and rebuild the bar.
928 RemoveAllBookmarkButtons(); 928 RemoveAllBookmarkButtons();
929 CreateAllBookmarkButtons(); 929 CreateAllBookmarkButtons();
930 } 930 }
931 931
932 void BookmarkBarGtk::Observe(NotificationType type, 932 void BookmarkBarGtk::Observe(int type,
933 const NotificationSource& source, 933 const NotificationSource& source,
934 const NotificationDetails& details) { 934 const NotificationDetails& details) {
935 if (type == NotificationType::BROWSER_THEME_CHANGED) { 935 if (type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED) {
936 if (model_ && model_->IsLoaded()) { 936 if (model_ && model_->IsLoaded()) {
937 // Regenerate the bookmark bar with all new objects with their theme 937 // Regenerate the bookmark bar with all new objects with their theme
938 // properties set correctly for the new theme. 938 // properties set correctly for the new theme.
939 RemoveAllBookmarkButtons(); 939 RemoveAllBookmarkButtons();
940 CreateAllBookmarkButtons(); 940 CreateAllBookmarkButtons();
941 } 941 }
942 942
943 UpdateEventBoxPaintability(); 943 UpdateEventBoxPaintability();
944 944
945 GdkColor paint_box_color = 945 GdkColor paint_box_color =
946 theme_service_->GetGdkColor(ThemeService::COLOR_TOOLBAR); 946 theme_service_->GetGdkColor(ThemeService::COLOR_TOOLBAR);
947 gtk_widget_modify_bg(paint_box_, GTK_STATE_NORMAL, &paint_box_color); 947 gtk_widget_modify_bg(paint_box_, GTK_STATE_NORMAL, &paint_box_color);
948 948
949 if (bookmark_bar_state_ == BookmarkBar::DETACHED) { 949 if (bookmark_bar_state_ == BookmarkBar::DETACHED) {
950 GdkColor stroke_color = theme_service_->UsingNativeTheme() ? 950 GdkColor stroke_color = theme_service_->UsingNativeTheme() ?
951 theme_service_->GetBorderColor() : 951 theme_service_->GetBorderColor() :
952 theme_service_->GetGdkColor(ThemeService::COLOR_NTP_HEADER); 952 theme_service_->GetGdkColor(ThemeService::COLOR_NTP_HEADER);
953 gtk_util::SetRoundedWindowBorderColor(paint_box_, stroke_color); 953 gtk_util::SetRoundedWindowBorderColor(paint_box_, stroke_color);
954 } 954 }
955 955
956 SetOverflowButtonAppearance(); 956 SetOverflowButtonAppearance();
957 } else if (type == NotificationType::PREF_CHANGED) { 957 } else if (type == chrome::PREF_CHANGED) {
958 const std::string& pref_name = *Details<std::string>(details).ptr(); 958 const std::string& pref_name = *Details<std::string>(details).ptr();
959 if (pref_name == prefs::kEditBookmarksEnabled) 959 if (pref_name == prefs::kEditBookmarksEnabled)
960 OnEditBookmarksEnabledChanged(); 960 OnEditBookmarksEnabledChanged();
961 } 961 }
962 } 962 }
963 963
964 GtkWidget* BookmarkBarGtk::CreateBookmarkButton(const BookmarkNode* node) { 964 GtkWidget* BookmarkBarGtk::CreateBookmarkButton(const BookmarkNode* node) {
965 GtkWidget* button = theme_service_->BuildChromeButton(); 965 GtkWidget* button = theme_service_->BuildChromeButton();
966 bookmark_utils::ConfigureButtonForNode(node, model_, button, theme_service_); 966 bookmark_utils::ConfigureButtonForNode(node, model_, button, theme_service_);
967 967
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 void BookmarkBarGtk::OnEditBookmarksEnabledChanged() { 1444 void BookmarkBarGtk::OnEditBookmarksEnabledChanged() {
1445 GtkDestDefaults dest_defaults = 1445 GtkDestDefaults dest_defaults =
1446 *edit_bookmarks_enabled_ ? GTK_DEST_DEFAULT_ALL : 1446 *edit_bookmarks_enabled_ ? GTK_DEST_DEFAULT_ALL :
1447 GTK_DEST_DEFAULT_DROP; 1447 GTK_DEST_DEFAULT_DROP;
1448 gtk_drag_dest_set(overflow_button_, dest_defaults, NULL, 0, kDragAction); 1448 gtk_drag_dest_set(overflow_button_, dest_defaults, NULL, 0, kDragAction);
1449 gtk_drag_dest_set(other_bookmarks_button_, dest_defaults, 1449 gtk_drag_dest_set(other_bookmarks_button_, dest_defaults,
1450 NULL, 0, kDragAction); 1450 NULL, 0, kDragAction);
1451 ui::SetDestTargetList(overflow_button_, kDestTargetList); 1451 ui::SetDestTargetList(overflow_button_, kDestTargetList);
1452 ui::SetDestTargetList(other_bookmarks_button_, kDestTargetList); 1452 ui::SetDestTargetList(other_bookmarks_button_, kDestTargetList);
1453 } 1453 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698