| 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/views/bookmarks/bookmark_bar_view.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1234 DCHECK(bookmark_button_index != -1 && | 1234 DCHECK(bookmark_button_index != -1 && |
| 1235 bookmark_button_index < GetBookmarkButtonCount()); | 1235 bookmark_button_index < GetBookmarkButtonCount()); |
| 1236 const BookmarkNode* node = | 1236 const BookmarkNode* node = |
| 1237 model_->bookmark_bar_node()->GetChild(bookmark_button_index); | 1237 model_->bookmark_bar_node()->GetChild(bookmark_button_index); |
| 1238 nodes.push_back(node); | 1238 nodes.push_back(node); |
| 1239 parent = node->parent(); | 1239 parent = node->parent(); |
| 1240 } else { | 1240 } else { |
| 1241 parent = model_->bookmark_bar_node(); | 1241 parent = model_->bookmark_bar_node(); |
| 1242 nodes.push_back(parent); | 1242 nodes.push_back(parent); |
| 1243 } | 1243 } |
| 1244 Profile* profile = browser_->profile(); | |
| 1245 bool close_on_remove = | 1244 bool close_on_remove = |
| 1246 (parent == BookmarkModelFactory::GetForProfile(profile)->other_node()) && | 1245 (parent == model_->other_node()) && (parent->child_count() == 1); |
| 1247 (parent->child_count() == 1); | 1246 |
| 1248 context_menu_.reset(new BookmarkContextMenu( | 1247 context_menu_.reset(new BookmarkContextMenu( |
| 1249 GetWidget(), browser_, profile, | 1248 GetWidget(), browser_, browser_->profile(), |
| 1250 browser_->tab_strip_model()->GetActiveWebContents(), | 1249 browser_->tab_strip_model()->GetActiveWebContents(), |
| 1251 parent, nodes, close_on_remove)); | 1250 parent, nodes, close_on_remove)); |
| 1252 context_menu_->RunMenuAt(point, source_type); | 1251 context_menu_->RunMenuAt(point, source_type); |
| 1253 } | 1252 } |
| 1254 | 1253 |
| 1255 void BookmarkBarView::Init() { | 1254 void BookmarkBarView::Init() { |
| 1256 // Note that at this point we're not in a hierarchy so GetThemeProvider() will | 1255 // Note that at this point we're not in a hierarchy so GetThemeProvider() will |
| 1257 // return NULL. When we're inserted into a hierarchy, we'll call | 1256 // return NULL. When we're inserted into a hierarchy, we'll call |
| 1258 // UpdateColors(), which will set the appropriate colors for all the objects | 1257 // UpdateColors(), which will set the appropriate colors for all the objects |
| 1259 // added in this function. | 1258 // added in this function. |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1852 DCHECK(apps_page_shortcut_); | 1851 DCHECK(apps_page_shortcut_); |
| 1853 // Only perform layout if required. | 1852 // Only perform layout if required. |
| 1854 bool visible = chrome::ShouldShowAppsShortcutInBookmarkBar( | 1853 bool visible = chrome::ShouldShowAppsShortcutInBookmarkBar( |
| 1855 browser_->profile()); | 1854 browser_->profile()); |
| 1856 if (apps_page_shortcut_->visible() == visible) | 1855 if (apps_page_shortcut_->visible() == visible) |
| 1857 return; | 1856 return; |
| 1858 apps_page_shortcut_->SetVisible(visible); | 1857 apps_page_shortcut_->SetVisible(visible); |
| 1859 UpdateBookmarksSeparatorVisibility(); | 1858 UpdateBookmarksSeparatorVisibility(); |
| 1860 Layout(); | 1859 Layout(); |
| 1861 } | 1860 } |
| OLD | NEW |