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

Unified Diff: chrome/browser/ui/cocoa/extensions/native_app_window_cocoa.mm

Issue 11889004: Fix a bug where the HTML content in a v2 app window wouldn't be initially focused. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disable test on gtk Created 7 years, 11 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/ui/cocoa/extensions/native_app_window_cocoa.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/extensions/native_app_window_cocoa.mm
diff --git a/chrome/browser/ui/cocoa/extensions/native_app_window_cocoa.mm b/chrome/browser/ui/cocoa/extensions/native_app_window_cocoa.mm
index e97e22f80dde1527c9add4851f5b00d0f024070c..a3e565706016dab3ed62d71ce0f4a3b61b3b6f27 100644
--- a/chrome/browser/ui/cocoa/extensions/native_app_window_cocoa.mm
+++ b/chrome/browser/ui/cocoa/extensions/native_app_window_cocoa.mm
@@ -13,6 +13,8 @@
#include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h"
#include "chrome/common/extensions/extension.h"
#include "content/public/browser/native_web_keyboard_event.h"
+#include "content/public/browser/notification_source.h"
+#include "content/public/browser/notification_types.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
@@ -262,6 +264,9 @@ NativeAppWindowCocoa::NativeAppWindowCocoa(
window,
extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY,
shell_window));
+ registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED,
+ content::Source<content::NavigationController>(
+ &web_contents()->GetController()));
}
void NativeAppWindowCocoa::InstallView() {
@@ -638,6 +643,17 @@ void NativeAppWindowCocoa::InstallDraggableRegionViews() {
}
}
+void NativeAppWindowCocoa::Observe(
+ int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) {
+ if (type == content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED) {
+ web_contents()->Focus();
+ return;
+ }
+ NOTREACHED();
+}
+
void NativeAppWindowCocoa::FlashFrame(bool flash) {
if (flash) {
attention_request_id_ = [NSApp requestUserAttention:NSInformationalRequest];
« no previous file with comments | « chrome/browser/ui/cocoa/extensions/native_app_window_cocoa.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698