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

Unified Diff: chrome/browser/views/shell_dialogs_win.cc

Issue 206004: Merge 26135 - The focus is not restored properly when a Windows modal dialog... (Closed) Base URL: svn://chrome-svn/chrome/branches/195/src/
Patch Set: Created 11 years, 3 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 | « no previous file | views/widget/widget_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/shell_dialogs_win.cc
===================================================================
--- chrome/browser/views/shell_dialogs_win.cc (revision 26159)
+++ chrome/browser/views/shell_dialogs_win.cc (working copy)
@@ -21,8 +21,6 @@
#include "base/thread.h"
#include "chrome/browser/browser_process.h"
#include "grit/generated_resources.h"
-#include "views/focus/focus_manager.h"
-#include "views/focus/view_storage.h"
// Helpers to show certain types of Windows shell dialogs in a way that doesn't
// block the UI of the entire app.
@@ -118,11 +116,6 @@
// This set only contains non-null HWNDs. NULL hwnds are not added to this
// list.
typedef std::set<HWND> Owners;
-
- // Storage id used to store the last focused view so we can restore focus
- // appropriately.
- int view_storage_id_;
-
static Owners owners_;
static int instance_count_;
@@ -134,9 +127,7 @@
int BaseShellDialogImpl::instance_count_ = 0;
BaseShellDialogImpl::BaseShellDialogImpl()
- : ui_loop_(MessageLoop::current()),
- view_storage_id_(views::ViewStorage::GetSharedInstance()->
- CreateStorageID()) {
+ : ui_loop_(MessageLoop::current()) {
++instance_count_;
}
@@ -157,20 +148,6 @@
run_state.owner = owner;
if (owner) {
owners_.insert(owner);
- // Disabling the owner causes the browser to be disabled when the dialog is
- // closed and the browser gets the activation. This messes up the normal
- // focus restoration process. To work-around this, we'll restore the focus
- // ourselves after we have reenabled the owner.
- views::FocusManager* focus_manager =
- views::FocusManager::GetFocusManagerForNativeView(owner);
- if (focus_manager) {
- views::View* focused_view = focus_manager->GetFocusedView();
- if (focused_view)
- views::ViewStorage::GetSharedInstance()->StoreView(view_storage_id_,
- focused_view);
- } else {
- NOTREACHED();
- }
DisableOwner(owner);
}
return run_state;
@@ -182,24 +159,6 @@
EnableOwner(run_state.owner);
DCHECK(owners_.find(run_state.owner) != owners_.end());
owners_.erase(run_state.owner);
- // Now that the owner is enabled, restore the focus if applicable.
- views::View* view_to_focus =
- views::ViewStorage::GetSharedInstance()->RetrieveView(view_storage_id_);
- if (view_to_focus) {
- views::ViewStorage::GetSharedInstance()->RemoveView(view_storage_id_);
- views::FocusManager* focus_manager =
- views::FocusManager::GetFocusManagerForNativeView(run_state.owner);
- if (focus_manager) {
- // We need to clear focus as when the focus is restored when the dialog
- // is closed, only setting the native focus fails. Meaning the focused
- // manager still believes the right view has focus, and would ignore
- // requesting focus to what it thinks is already focused.
- focus_manager->ClearFocus();
- view_to_focus->RequestFocus();
- } else {
- NOTREACHED();
- }
- }
}
DCHECK(run_state.dialog_thread);
delete run_state.dialog_thread;
Property changes on: chrome\browser\views\shell_dialogs_win.cc
___________________________________________________________________
Modified: svn:mergeinfo
Merged /trunk/src/chrome/browser/views/shell_dialogs_win.cc:r26135
« no previous file with comments | « no previous file | views/widget/widget_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698