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/bookmark_bar_gtk.h" | 5 #include "chrome/browser/ui/gtk/bookmark_bar_gtk.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/bookmarks/bookmark_node_data.h" | 10 #include "chrome/browser/bookmarks/bookmark_node_data.h" |
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 // it manually by telling the toolbar area to redraw itself. | 798 // it manually by telling the toolbar area to redraw itself. |
799 window_->QueueToolbarRedraw(); | 799 window_->QueueToolbarRedraw(); |
800 } | 800 } |
801 } | 801 } |
802 } | 802 } |
803 | 803 |
804 void BookmarkBarGtk::Observe(NotificationType type, | 804 void BookmarkBarGtk::Observe(NotificationType type, |
805 const NotificationSource& source, | 805 const NotificationSource& source, |
806 const NotificationDetails& details) { | 806 const NotificationDetails& details) { |
807 if (type == NotificationType::BROWSER_THEME_CHANGED) { | 807 if (type == NotificationType::BROWSER_THEME_CHANGED) { |
808 if (model_) { | 808 if (model_ && model_->IsLoaded()) { |
809 // Regenerate the bookmark bar with all new objects with their theme | 809 // Regenerate the bookmark bar with all new objects with their theme |
810 // properties set correctly for the new theme. | 810 // properties set correctly for the new theme. |
811 RemoveAllBookmarkButtons(); | 811 RemoveAllBookmarkButtons(); |
812 CreateAllBookmarkButtons(); | 812 CreateAllBookmarkButtons(); |
813 } else { | |
814 DLOG(ERROR) << "Received a theme change notification while we " | |
815 << "don't have a BookmarkModel. Taking no action."; | |
816 } | 813 } |
817 | 814 |
818 UpdateEventBoxPaintability(); | 815 UpdateEventBoxPaintability(); |
819 | 816 |
820 GdkColor paint_box_color = | 817 GdkColor paint_box_color = |
821 theme_provider_->GetGdkColor(BrowserThemeProvider::COLOR_TOOLBAR); | 818 theme_provider_->GetGdkColor(BrowserThemeProvider::COLOR_TOOLBAR); |
822 gtk_widget_modify_bg(paint_box_, GTK_STATE_NORMAL, &paint_box_color); | 819 gtk_widget_modify_bg(paint_box_, GTK_STATE_NORMAL, &paint_box_color); |
823 | 820 |
824 if (floating_) { | 821 if (floating_) { |
825 GdkColor stroke_color = theme_provider_->UseGtkTheme() ? | 822 GdkColor stroke_color = theme_provider_->UseGtkTheme() ? |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1407 | 1404 |
1408 // Find the GtkWidget* for the actual target button. | 1405 // Find the GtkWidget* for the actual target button. |
1409 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; | 1406 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; |
1410 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); | 1407 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); |
1411 PopupForButton(folder_list[button_idx]); | 1408 PopupForButton(folder_list[button_idx]); |
1412 } | 1409 } |
1413 | 1410 |
1414 void BookmarkBarGtk::CloseMenu() { | 1411 void BookmarkBarGtk::CloseMenu() { |
1415 current_context_menu_->Cancel(); | 1412 current_context_menu_->Cancel(); |
1416 } | 1413 } |
OLD | NEW |