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

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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) 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 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h"
6 6
7 #include "base/mac/bundle_locations.h" 7 #include "base/mac/bundle_locations.h"
8 #include "base/mac/mac_util.h" 8 #include "base/mac/mac_util.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
11 #include "chrome/browser/bookmarks/bookmark_editor.h" 11 #include "chrome/browser/bookmarks/bookmark_editor.h"
12 #include "chrome/browser/bookmarks/bookmark_model.h" 12 #include "chrome/browser/bookmarks/bookmark_model.h"
13 #include "chrome/browser/bookmarks/bookmark_utils.h" 13 #include "chrome/browser/bookmarks/bookmark_utils.h"
14 #include "chrome/browser/extensions/extension_service.h" 14 #include "chrome/browser/extensions/extension_service.h"
15 #include "chrome/browser/prefs/incognito_mode_prefs.h" 15 #include "chrome/browser/prefs/incognito_mode_prefs.h"
16 #include "chrome/browser/prefs/pref_service.h" 16 #include "chrome/browser/prefs/pref_service.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #import "chrome/browser/themes/theme_service.h" 18 #import "chrome/browser/themes/theme_service.h"
19 #import "chrome/browser/themes/theme_service_factory.h" 19 #import "chrome/browser/themes/theme_service_factory.h"
20 #include "chrome/browser/ui/browser.h" 20 #include "chrome/browser/ui/browser.h"
21 #include "chrome/browser/ui/browser_list.h" 21 #include "chrome/browser/ui/browser_list.h"
22 #include "chrome/browser/ui/browser_tabstrip.h"
22 #include "chrome/browser/ui/chrome_pages.h" 23 #include "chrome/browser/ui/chrome_pages.h"
23 #import "chrome/browser/ui/cocoa/background_gradient_view.h" 24 #import "chrome/browser/ui/cocoa/background_gradient_view.h"
24 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_bridge.h" 25 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_bridge.h"
25 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h" 26 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h"
26 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_window.h" 27 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_window.h"
27 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.h" 28 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.h"
28 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_view.h" 29 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_view.h"
29 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" 30 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h"
30 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h" 31 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h"
31 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.h" 32 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.h"
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 783
783 // May be called from the bar or from a folder button. 784 // May be called from the bar or from a folder button.
784 // If called from a button, that button becomes the parent. 785 // If called from a button, that button becomes the parent.
785 - (IBAction)addPage:(id)sender { 786 - (IBAction)addPage:(id)sender {
786 const BookmarkNode* parent = [self nodeFromMenuItem:sender]; 787 const BookmarkNode* parent = [self nodeFromMenuItem:sender];
787 if (!parent) 788 if (!parent)
788 parent = bookmarkModel_->bookmark_bar_node(); 789 parent = bookmarkModel_->bookmark_bar_node();
789 GURL url; 790 GURL url;
790 string16 title; 791 string16 title;
791 bookmark_utils::GetURLAndTitleToBookmark( 792 bookmark_utils::GetURLAndTitleToBookmark(
792 browser_->GetActiveWebContents(), &url, &title); 793 chrome::GetActiveWebContents(browser_), &url, &title);
793 BookmarkEditor::Show([[self view] window], 794 BookmarkEditor::Show([[self view] window],
794 browser_->profile(), 795 browser_->profile(),
795 BookmarkEditor::EditDetails::AddNodeInFolder( 796 BookmarkEditor::EditDetails::AddNodeInFolder(
796 parent, -1, url, title), 797 parent, -1, url, title),
797 BookmarkEditor::SHOW_TREE); 798 BookmarkEditor::SHOW_TREE);
798 } 799 }
799 800
800 // Might be called from the context menu over the bar OR over a 801 // Might be called from the context menu over the bar OR over a
801 // button. If called from a button, that button becomes a sibling of 802 // button. If called from a button, that button becomes a sibling of
802 // the new node. If called from the bar, add to the end of the bar. 803 // the new node. If called from the bar, add to the end of the bar.
(...skipping 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after
2286 if ([self isAnimatingFromState:bookmarks::kDetachedState]) { 2287 if ([self isAnimatingFromState:bookmarks::kDetachedState]) {
2287 return static_cast<CGFloat>( 2288 return static_cast<CGFloat>(
2288 1 - [[self animatableView] currentAnimationProgress]); 2289 1 - [[self animatableView] currentAnimationProgress]);
2289 } 2290 }
2290 return 0; 2291 return 0;
2291 } 2292 }
2292 2293
2293 #pragma mark BookmarkBarToolbarViewController Protocol 2294 #pragma mark BookmarkBarToolbarViewController Protocol
2294 2295
2295 - (int)currentTabContentsHeight { 2296 - (int)currentTabContentsHeight {
2296 WebContents* wc = browser_->GetActiveWebContents(); 2297 WebContents* wc = chrome::GetActiveWebContents(browser_);
2297 return wc ? wc->GetView()->GetContainerSize().height() : 0; 2298 return wc ? wc->GetView()->GetContainerSize().height() : 0;
2298 } 2299 }
2299 2300
2300 - (ui::ThemeProvider*)themeProvider { 2301 - (ui::ThemeProvider*)themeProvider {
2301 return ThemeServiceFactory::GetForProfile(browser_->profile()); 2302 return ThemeServiceFactory::GetForProfile(browser_->profile());
2302 } 2303 }
2303 2304
2304 #pragma mark BookmarkButtonDelegate Protocol 2305 #pragma mark BookmarkButtonDelegate Protocol
2305 2306
2306 - (void)fillPasteboard:(NSPasteboard*)pboard 2307 - (void)fillPasteboard:(NSPasteboard*)pboard
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
2792 // to minimize touching the object passed in (likely a mock). 2793 // to minimize touching the object passed in (likely a mock).
2793 - (void)setButtonContextMenu:(id)menu { 2794 - (void)setButtonContextMenu:(id)menu {
2794 buttonContextMenu_ = menu; 2795 buttonContextMenu_ = menu;
2795 } 2796 }
2796 2797
2797 - (void)setIgnoreAnimations:(BOOL)ignore { 2798 - (void)setIgnoreAnimations:(BOOL)ignore {
2798 ignoreAnimations_ = ignore; 2799 ignoreAnimations_ = ignore;
2799 } 2800 }
2800 2801
2801 @end 2802 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller.mm ('k') | chrome/browser/ui/cocoa/browser_window_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698