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

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: 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..f102394bfe8c2b80f02ab59920280a07a45d13b8 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,19 @@ void NativeAppWindowCocoa::InstallDraggableRegionViews() {
}
}
+void NativeAppWindowCocoa::Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) {
Avi (use Gerrit) 2013/01/14 17:10:03 bad indentation
+ if (type == content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED) {
+ if (content::RenderWidgetHostView* rwhv =
+ web_contents()->GetRenderWidgetHostView()) {
+ rwhv->Focus();
Avi (use Gerrit) 2013/01/14 17:10:03 I'm not clear on why this wouldn't be working. Is
jeremya 2013/01/15 05:49:52 The bug happens even for non-frameless windows. I
+ }
+ 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