summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormaf@chromium.org <maf@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-16 23:28:43 +0000
committermaf@chromium.org <maf@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-16 23:28:43 +0000
commitc5d85b0b01f74b5786a58d5ce7be8b6c0018d55b (patch)
tree7238a8b34fc3a36f3bb8bfac68e5ce1e16939960
parentd429df3477c4c112696e92c035ae5f08a62c059c (diff)
downloadchromium_src-c5d85b0b01f74b5786a58d5ce7be8b6c0018d55b.zip
chromium_src-c5d85b0b01f74b5786a58d5ce7be8b6c0018d55b.tar.gz
chromium_src-c5d85b0b01f74b5786a58d5ce7be8b6c0018d55b.tar.bz2
Commit Instant if needed before handling a web page context menu.
Avoids the situation where contextual menu commands like "Open Link in New Tab" get ignored, because it's being handled with the Instant dummy loader still in place. BUG=73259 Review URL: http://codereview.chromium.org/6874030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81886 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/tab_contents/render_view_context_menu_mac.h1
-rw-r--r--chrome/browser/tab_contents/render_view_context_menu_mac.mm6
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller.h1
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller.mm7
4 files changed, 15 insertions, 0 deletions
diff --git a/chrome/browser/tab_contents/render_view_context_menu_mac.h b/chrome/browser/tab_contents/render_view_context_menu_mac.h
index 6c5748d..5c52a5b 100644
--- a/chrome/browser/tab_contents/render_view_context_menu_mac.h
+++ b/chrome/browser/tab_contents/render_view_context_menu_mac.h
@@ -23,6 +23,7 @@ class RenderViewContextMenuMac : public RenderViewContextMenu {
const ContextMenuParams& params,
NSView* parent_view);
virtual ~RenderViewContextMenuMac();
+ virtual void ExecuteCommand(int id);
protected:
// RenderViewContextMenu implementation-
diff --git a/chrome/browser/tab_contents/render_view_context_menu_mac.mm b/chrome/browser/tab_contents/render_view_context_menu_mac.mm
index bcb60ed..c1fe12d 100644
--- a/chrome/browser/tab_contents/render_view_context_menu_mac.mm
+++ b/chrome/browser/tab_contents/render_view_context_menu_mac.mm
@@ -9,6 +9,7 @@
#include "base/message_loop.h"
#include "base/sys_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
+#import "chrome/browser/ui/cocoa/browser_window_controller.h"
#import "chrome/browser/ui/cocoa/menu_controller.h"
#include "grit/generated_resources.h"
@@ -59,6 +60,11 @@ void RenderViewContextMenuMac::PlatformInit() {
}
}
+void RenderViewContextMenuMac::ExecuteCommand(int id) {
+ [[[parent_view_ window] windowController] commitInstant];
+ RenderViewContextMenu::ExecuteCommand(id);
+}
+
bool RenderViewContextMenuMac::GetAcceleratorForCommandId(
int command_id,
ui::Accelerator* accelerator) {
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.h b/chrome/browser/ui/cocoa/browser_window_controller.h
index d1e2859..cc72002 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.h
+++ b/chrome/browser/ui/cocoa/browser_window_controller.h
@@ -267,6 +267,7 @@ class TabContents;
// Shows or hides the Instant preview contents.
- (void)showInstant:(TabContents*)previewContents;
- (void)hideInstant;
+- (void)commitInstant;
// Returns the frame, in Cocoa (unflipped) screen coordinates, of the area where
// Instant results are. If Instant is not showing, returns the frame of where
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm
index a4fa6d3..6441e3b 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -14,6 +14,7 @@
#include "chrome/app/chrome_command_ids.h" // IDC_*
#include "chrome/browser/bookmarks/bookmark_editor.h"
#include "chrome/browser/google/google_util.h"
+#include "chrome/browser/instant/instant_controller.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/sync_ui_util_mac.h"
@@ -63,6 +64,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/l10n/l10n_util_mac.h"
+
// ORGANIZATION: This is a big file. It is (in principle) organized as follows
// (in order):
// 1. Interfaces. Very short, one-time-use classes may include an implementation
@@ -1859,6 +1861,11 @@ willAnimateFromState:(bookmarks::VisualState)oldState
[self updateBookmarkBarVisibilityWithAnimation:NO];
}
+- (void)commitInstant {
+ InstantController::CommitIfCurrent(browser_->instant());
+}
+
+
- (NSRect)instantFrame {
// The view's bounds are in its own coordinate system. Convert that to the
// window base coordinate system, then translate it into the screen's