| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/gtk/bookmark_bar_gtk.h" | 5 #include "chrome/browser/gtk/bookmark_bar_gtk.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "app/gtk_dnd_util.h" | 9 #include "app/gtk_dnd_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/bookmarks/bookmark_drag_data.h" | 12 #include "chrome/browser/bookmarks/bookmark_drag_data.h" |
| 13 #include "chrome/browser/bookmarks/bookmark_model.h" | 13 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 14 #include "chrome/browser/bookmarks/bookmark_utils.h" | 14 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 15 #include "chrome/browser/browser_shutdown.h" |
| 15 #include "chrome/browser/browser.h" | 16 #include "chrome/browser/browser.h" |
| 16 #include "chrome/browser/gtk/bookmark_menu_controller_gtk.h" | 17 #include "chrome/browser/gtk/bookmark_menu_controller_gtk.h" |
| 17 #include "chrome/browser/gtk/bookmark_tree_model.h" | 18 #include "chrome/browser/gtk/bookmark_tree_model.h" |
| 18 #include "chrome/browser/gtk/bookmark_utils_gtk.h" | 19 #include "chrome/browser/gtk/bookmark_utils_gtk.h" |
| 19 #include "chrome/browser/gtk/browser_window_gtk.h" | 20 #include "chrome/browser/gtk/browser_window_gtk.h" |
| 20 #include "chrome/browser/gtk/cairo_cached_surface.h" | 21 #include "chrome/browser/gtk/cairo_cached_surface.h" |
| 21 #include "chrome/browser/gtk/custom_button.h" | 22 #include "chrome/browser/gtk/custom_button.h" |
| 22 #include "chrome/browser/gtk/gtk_chrome_button.h" | 23 #include "chrome/browser/gtk/gtk_chrome_button.h" |
| 23 #include "chrome/browser/gtk/gtk_theme_provider.h" | 24 #include "chrome/browser/gtk/gtk_theme_provider.h" |
| 24 #include "chrome/browser/gtk/gtk_util.h" | 25 #include "chrome/browser/gtk/gtk_util.h" |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 if (!instructions_) | 405 if (!instructions_) |
| 405 return; | 406 return; |
| 406 | 407 |
| 407 RemoveAllBookmarkButtons(); | 408 RemoveAllBookmarkButtons(); |
| 408 CreateAllBookmarkButtons(); | 409 CreateAllBookmarkButtons(); |
| 409 } | 410 } |
| 410 | 411 |
| 411 void BookmarkBarGtk::BookmarkModelBeingDeleted(BookmarkModel* model) { | 412 void BookmarkBarGtk::BookmarkModelBeingDeleted(BookmarkModel* model) { |
| 412 // The bookmark model should never be deleted before us. This code exists | 413 // The bookmark model should never be deleted before us. This code exists |
| 413 // to check for regressions in shutdown code and not crash. | 414 // to check for regressions in shutdown code and not crash. |
| 414 NOTREACHED(); | 415 if (!browser_shutdown::ShuttingDownWithoutClosingBrowsers()) |
| 416 NOTREACHED(); |
| 415 | 417 |
| 416 // Do minimal cleanup, presumably we'll be deleted shortly. | 418 // Do minimal cleanup, presumably we'll be deleted shortly. |
| 417 model_->RemoveObserver(this); | 419 model_->RemoveObserver(this); |
| 418 model_ = NULL; | 420 model_ = NULL; |
| 419 } | 421 } |
| 420 | 422 |
| 421 void BookmarkBarGtk::BookmarkNodeMoved(BookmarkModel* model, | 423 void BookmarkBarGtk::BookmarkNodeMoved(BookmarkModel* model, |
| 422 const BookmarkNode* old_parent, | 424 const BookmarkNode* old_parent, |
| 423 int old_index, | 425 int old_index, |
| 424 const BookmarkNode* new_parent, | 426 const BookmarkNode* new_parent, |
| (...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1358 | 1360 |
| 1359 // Find the GtkWidget* for the actual target button. | 1361 // Find the GtkWidget* for the actual target button. |
| 1360 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; | 1362 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; |
| 1361 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); | 1363 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); |
| 1362 PopupForButton(folder_list[button_idx]); | 1364 PopupForButton(folder_list[button_idx]); |
| 1363 } | 1365 } |
| 1364 | 1366 |
| 1365 void BookmarkBarGtk::CloseMenu() { | 1367 void BookmarkBarGtk::CloseMenu() { |
| 1366 current_context_menu_->Cancel(); | 1368 current_context_menu_->Cancel(); |
| 1367 } | 1369 } |
| OLD | NEW |