summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/toolbar_controller.mm
diff options
context:
space:
mode:
authorpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-17 19:52:40 +0000
committerpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-17 19:52:40 +0000
commit70a07ef6d9647d7b519638352cd17fa00ff22107 (patch)
tree76582ec88612d5ebd01009ef2b1bb672d123d65e /chrome/browser/cocoa/toolbar_controller.mm
parent682343d9f1b8db68c75ab3c4632af2022dcc5ddf (diff)
downloadchromium_src-70a07ef6d9647d7b519638352cd17fa00ff22107.zip
chromium_src-70a07ef6d9647d7b519638352cd17fa00ff22107.tar.gz
chromium_src-70a07ef6d9647d7b519638352cd17fa00ff22107.tar.bz2
Implement a unit test for the toolbar controller. Plumb the profile into the loation bar instead of picking it up globally, which cannnot be unit tested.
Review URL: http://codereview.chromium.org/79041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13959 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/toolbar_controller.mm')
-rw-r--r--chrome/browser/cocoa/toolbar_controller.mm18
1 files changed, 14 insertions, 4 deletions
diff --git a/chrome/browser/cocoa/toolbar_controller.mm b/chrome/browser/cocoa/toolbar_controller.mm
index a44cccd..9cd7739 100644
--- a/chrome/browser/cocoa/toolbar_controller.mm
+++ b/chrome/browser/cocoa/toolbar_controller.mm
@@ -4,6 +4,7 @@
#import "chrome/browser/cocoa/toolbar_controller.h"
+#include "base/mac_util.h"
#include "base/sys_string_conversions.h"
#include "chrome/app/chrome_dll_resource.h"
#import "chrome/browser/cocoa/location_bar_view_mac.h"
@@ -20,11 +21,14 @@ static NSString* const kStarredImageName = @"starred";
@implementation ToolbarController
- (id)initWithModel:(ToolbarModel*)model
- commands:(CommandUpdater*)commands {
- DCHECK(model && commands);
- if ((self = [super initWithNibName:@"Toolbar" bundle:nil])) {
+ commands:(CommandUpdater*)commands
+ profile:(Profile*)profile {
+ DCHECK(model && commands && profile);
+ if ((self = [super initWithNibName:@"Toolbar"
+ bundle:mac_util::MainAppBundle()])) {
toolbarModel_ = model;
commands_ = commands;
+ profile_ = profile;
// Register for notifications about state changes for the toolbar buttons
commandObserver_.reset(new CommandObserverBridge(self, commands));
@@ -43,7 +47,7 @@ static NSString* const kStarredImageName = @"starred";
- (void)awakeFromNib {
[self initCommandStatus:commands_];
locationBarView_.reset(new LocationBarViewMac(locationBar_, commands_,
- toolbarModel_));
+ toolbarModel_, profile_));
locationBarView_->Init();
[locationBar_ setStringValue:@"http://dev.chromium.org"];
}
@@ -132,4 +136,10 @@ static NSString* const kStarredImageName = @"starred";
[goButton_ setImage:[NSImage imageNamed:imageName]];
}
+// Returns an array of views in the order of the outlets above.
+- (NSArray*)toolbarViews {
+ return [NSArray arrayWithObjects:backButton_, forwardButton_, reloadButton_,
+ starButton_, goButton_, locationBar_, nil];
+}
+
@end