summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa
diff options
context:
space:
mode:
authorpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-17 14:45:03 +0000
committerpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-17 14:45:03 +0000
commit93ca8ed5063f03b0b8c0745a33080a5b9c43b19e (patch)
tree61ec51f3c879e98dc67a60348aa3ae963a339004 /chrome/browser/cocoa
parentd166778946fbef7731106cf2e4b17b58e847da24 (diff)
downloadchromium_src-93ca8ed5063f03b0b8c0745a33080a5b9c43b19e.zip
chromium_src-93ca8ed5063f03b0b8c0745a33080a5b9c43b19e.tar.gz
chromium_src-93ca8ed5063f03b0b8c0745a33080a5b9c43b19e.tar.bz2
Implement SetStarredState on LocationBar for Mac.
Review URL: http://codereview.chromium.org/21317 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9874 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r--chrome/browser/cocoa/tab_contents_controller.h3
-rw-r--r--chrome/browser/cocoa/tab_contents_controller.mm11
-rw-r--r--chrome/browser/cocoa/tab_strip_controller.h3
-rw-r--r--chrome/browser/cocoa/tab_strip_controller.mm11
4 files changed, 26 insertions, 2 deletions
diff --git a/chrome/browser/cocoa/tab_contents_controller.h b/chrome/browser/cocoa/tab_contents_controller.h
index 991a783..a5dd5dc 100644
--- a/chrome/browser/cocoa/tab_contents_controller.h
+++ b/chrome/browser/cocoa/tab_contents_controller.h
@@ -61,6 +61,9 @@ class TabStripModel;
// it points to a TabContents whose state we should restore.
- (void)updateToolbarWithContents:(TabContents*)tabForRestoring;
+// Sets whether or not the current page in the frontmost tab is bookmarked.
+- (void)setStarredState:(BOOL)isStarred;
+
@end
#endif // CHROME_BROWSER_COCOA_TAB_COTNENTS_CONTROLLER_H_
diff --git a/chrome/browser/cocoa/tab_contents_controller.mm b/chrome/browser/cocoa/tab_contents_controller.mm
index 83d9c7d..b338745 100644
--- a/chrome/browser/cocoa/tab_contents_controller.mm
+++ b/chrome/browser/cocoa/tab_contents_controller.mm
@@ -12,6 +12,10 @@
// For now, tab_contents lives here. TODO(port):fix
#include "chrome/common/temp_scaffolding_stubs.h"
+// Names of images in the bundle for the star icon (normal and 'starred').
+static NSString* const kStarImageName = @"star";
+static NSString* const kStarredImageName = @"starred";
+
@interface TabContentsController(CommandUpdates)
- (void)enabledStateChangedForCommand:(NSInteger)command enabled:(BOOL)enabled;
@end
@@ -186,6 +190,13 @@ class LocationBarBridge : public LocationBar {
}
}
+- (void)setStarredState:(BOOL)isStarred {
+ NSString* starImageName = kStarImageName;
+ if (isStarred)
+ starImageName = kStarredImageName;
+ [starButton_ setImage:[NSImage imageNamed:starImageName]];
+}
+
@end
//--------------------------------------------------------------------------
diff --git a/chrome/browser/cocoa/tab_strip_controller.h b/chrome/browser/cocoa/tab_strip_controller.h
index 1564983..2f1bcbf 100644
--- a/chrome/browser/cocoa/tab_strip_controller.h
+++ b/chrome/browser/cocoa/tab_strip_controller.h
@@ -54,6 +54,9 @@ class TabContents;
- (void)updateToolbarWithContents:(TabContents*)tab
shouldRestoreState:(BOOL)shouldRestore;
+// Sets whether or not the current page in the frontmost tab is bookmarked.
+- (void)setStarredState:(BOOL)isStarred;
+
@end
#endif // CHROME_BROWSER_COCOA_TAB_STRIP_CONTROLLER_H_
diff --git a/chrome/browser/cocoa/tab_strip_controller.mm b/chrome/browser/cocoa/tab_strip_controller.mm
index 9488695..0c5b4c6 100644
--- a/chrome/browser/cocoa/tab_strip_controller.mm
+++ b/chrome/browser/cocoa/tab_strip_controller.mm
@@ -289,8 +289,8 @@ class TabStripBridge : public TabStripModelObserver {
- (void)updateToolbarWithContents:(TabContents*)tab
shouldRestoreState:(BOOL)shouldRestore {
- // TODO(pinkerton): windows maintains this, we probably should though we
- // currently aren't using it.
+ // TODO(pinkerton): OS_WIN maintains this, but I'm not sure why. It's
+ // available by querying the model, which we have available to us.
currentTab_ = tab;
// tell the appropriate controller to update its state. |shouldRestore| being
@@ -300,6 +300,13 @@ class TabStripBridge : public TabStripModelObserver {
[controller updateToolbarWithContents:shouldRestore ? tab : nil];
}
+- (void)setStarredState:(BOOL)isStarred {
+ TabContents* selectedContents = model_->GetSelectedTabContents();
+ TabContentsController* selectedController =
+ [self controllerWithContents:selectedContents];
+ [selectedController setStarredState:isStarred];
+}
+
@end
//--------------------------------------------------------------------------