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

Unified Diff: chrome/browser/cocoa/history_menu_cocoa_controller.mm

Issue 174021: Convert users of the "get last active browser, get selected tab contents, ope... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/cocoa/browser_window_controller.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/history_menu_cocoa_controller.mm
===================================================================
--- chrome/browser/cocoa/history_menu_cocoa_controller.mm (revision 23676)
+++ chrome/browser/cocoa/history_menu_cocoa_controller.mm (working copy)
@@ -7,10 +7,10 @@
#import "chrome/browser/cocoa/history_menu_cocoa_controller.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/cocoa/event_utils.h"
#include "chrome/browser/history/history.h"
#include "chrome/browser/history/history_types.h"
#include "chrome/browser/tab_contents/tab_contents.h"
-#import "chrome/common/cocoa_utils.h"
#include "webkit/glue/window_open_disposition.h"
@implementation HistoryMenuCocoaController
@@ -25,21 +25,11 @@
// Open the URL of the given history item in the current tab.
- (void)openURLForItem:(HistoryMenuBridge::HistoryItem&)node {
- Browser* browser = BrowserList::GetLastActive();
-
- if (!browser) { // No windows open?
- Browser::OpenEmptyWindow(bridge_->profile());
- browser = BrowserList::GetLastActive();
- }
- DCHECK(browser);
- TabContents* tab_contents = browser->GetSelectedTabContents();
- DCHECK(tab_contents);
-
- // A TabContents is a PageNavigator, so we can OpenURL() on it.
- WindowOpenDisposition disposition = event_utils::DispositionFromEventFlags(
- [[NSApp currentEvent] modifierFlags]);
- tab_contents->OpenURL(node.url, GURL(), disposition,
- PageTransition::AUTO_BOOKMARK);
+ Browser* browser = Browser::GetOrCreateTabbedBrowser(bridge_->profile());
+ WindowOpenDisposition disposition =
+ event_utils::WindowOpenDispositionFromNSEvent([NSApp currentEvent]);
+ browser->OpenURL(node.url, GURL(), disposition,
+ PageTransition::AUTO_BOOKMARK);
}
- (HistoryMenuBridge::HistoryItem)itemForTag:(NSInteger)tag {
« no previous file with comments | « chrome/browser/cocoa/browser_window_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698