Skip to content

Commit d699ce8

Browse files
committed
[WIN] Fix urlbar focus issue
urlbar was changed to View based in upstream; the webview needs to be properly focused to move focus away from urlbar, or urlbar won't take focus again since it thinks it is focused already
1 parent 590c922 commit d699ce8

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

src/browser/native_window_win.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ class NativeWindowWin : public NativeWindow,
125125
ui::WindowShowState show_state) OVERRIDE;
126126

127127
private:
128+
friend class content::Shell;
128129
void OnViewWasResized();
129130

130131
NativeWindowToolbarWin* toolbar_;

src/nw_shell.cc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@
6060
#include "net/base/escape.h"
6161
#include "ui/base/resource/resource_bundle.h"
6262

63+
64+
#if defined(OS_WIN)
65+
#include "content/nw/src/browser/native_window_win.h"
66+
#include "ui/views/controls/webview/webview.h"
67+
using nw::NativeWindowWin;
68+
#endif
69+
6370
#include "content/nw/src/browser/printing/print_view_manager.h"
6471

6572
using base::MessageLoop;
@@ -476,6 +483,13 @@ void Shell::WebContentsCreated(WebContents* source_contents,
476483
Shell::Create(source_contents, GURL::EmptyGURL(), manifest.get(), new_contents);
477484
}
478485

486+
#if defined(OS_WIN)
487+
void Shell::WebContentsFocused(content::WebContents* web_contents) {
488+
NativeWindowWin* win = static_cast<NativeWindowWin*>(window_.get());
489+
win->web_view_->OnWebContentsFocused(web_contents);
490+
}
491+
#endif
492+
479493
content::ColorChooser*
480494
Shell::OpenColorChooser(content::WebContents* web_contents, SkColor color) {
481495
return nw::ShowColorChooser(web_contents, color);

src/nw_shell.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ class Shell : public WebContentsDelegate,
148148
const string16& frame_name,
149149
const GURL& target_url,
150150
WebContents* new_contents) OVERRIDE;
151+
#if defined(OS_WIN)
152+
virtual void WebContentsFocused(WebContents* contents) OVERRIDE;
153+
#endif
151154
virtual content::ColorChooser* OpenColorChooser(
152155
content::WebContents* web_contents, SkColor color) OVERRIDE;
153156
virtual void RunFileChooser(

0 commit comments

Comments
 (0)