diff options
author | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-25 22:11:43 +0000 |
---|---|---|
committer | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-25 22:11:43 +0000 |
commit | 3f34599d40afee4d071e33c12278931764dd7c56 (patch) | |
tree | 018bf8b9a56134fd022a12b964e297999fcb17f2 /chrome/browser/app_controller_mac.mm | |
parent | c9d989b20d74fcd1de89d5aad90f5ad11d11801c (diff) | |
download | chromium_src-3f34599d40afee4d071e33c12278931764dd7c56.zip chromium_src-3f34599d40afee4d071e33c12278931764dd7c56.tar.gz chromium_src-3f34599d40afee4d071e33c12278931764dd7c56.tar.bz2 |
Bookmark menu work. Notes:
- "add bookmark" menu item enable state (e.g. disabled if no windows)
- bookmark menus built dynamically (like before)
- bookmark menus rebuild when a bookmark is added/removed
- bookmark menus take the current browser to where you want to go
- works with multiple windows (main window goes to bookmark location)
- works with no windows (bookmarks open a new window)
Review URL: http://codereview.chromium.org/49005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12501 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/app_controller_mac.mm')
-rw-r--r-- | chrome/browser/app_controller_mac.mm | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm index 9bd9de2..98ed64b 100644 --- a/chrome/browser/app_controller_mac.mm +++ b/chrome/browser/app_controller_mac.mm @@ -9,6 +9,7 @@ #import "chrome/browser/browser.h" #import "chrome/browser/browser_list.h" #include "chrome/browser/browser_shutdown.h" +#import "chrome/browser/cocoa/bookmark_menu_bridge.h" #import "chrome/browser/command_updater.h" #import "chrome/browser/profile_manager.h" #import "chrome/common/temp_scaffolding_stubs.h" @@ -22,6 +23,7 @@ - (void)awakeFromNib { // Set up the command updater for when there are no windows open [self initMenuState]; + bookmarkMenuBridge_ = new BookmarkMenuBridge(); } - (void)applicationDidFinishLaunching:(NSNotification*)notify { @@ -33,6 +35,7 @@ } - (void)dealloc { + delete bookmarkMenuBridge_; delete menuState_; [super dealloc]; } @@ -87,8 +90,7 @@ // command is supported and doesn't check, otherwise it would have been disabled // in the UI in validateUserInterfaceItem:. - (void)commandDispatch:(id)sender { - // How to get the profile created on line 314 of browser_main? Ugh. TODO:FIXME - Profile* default_profile = *g_browser_process->profile_manager()->begin(); + Profile* default_profile = [self defaultProfile]; NSInteger tag = [sender tag]; switch (tag) { @@ -108,4 +110,16 @@ // TODO(pinkerton): ...more to come... } +- (Profile*)defaultProfile { + // Only expected to return NULL in a unit test (if g_browser_process + // is a TestingBrowserProcess). + // TODO(jrg): DCHECK() to confirm that. + // TODO(jrg): Find a better way to get the "default" profile. + if (g_browser_process->profile_manager()) + return *g_browser_process->profile_manager()->begin(); + return NULL; + +} + + @end |