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

Side by Side Diff: chrome/browser/views/constrained_window_impl.cc

Issue 8786: Fix default focused button in dialogs (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/views/dialog_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/views/constrained_window_impl.h" 5 #include "chrome/browser/views/constrained_window_impl.h"
6 6
7 #include "base/gfx/rect.h" 7 #include "base/gfx/rect.h"
8 #include "chrome/app/chrome_dll_resource.h" 8 #include "chrome/app/chrome_dll_resource.h"
9 #include "chrome/app/theme/theme_resources.h" 9 #include "chrome/app/theme/theme_resources.h"
10 #include "chrome/browser/tab_contents.h" 10 #include "chrome/browser/tab_contents.h"
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 // that case and replay them when the WebContents becomes selected. 861 // that case and replay them when the WebContents becomes selected.
862 focus_manager->StoreFocusedView(); 862 focus_manager->StoreFocusedView();
863 863
864 if (constrained_contents_) { 864 if (constrained_contents_) {
865 // We contain another window, let's assume it knows how to process the 865 // We contain another window, let's assume it knows how to process the
866 // focus and let's focus it. 866 // focus and let's focus it.
867 // TODO(jcampan): so far this case is the WebContents case. We need to 867 // TODO(jcampan): so far this case is the WebContents case. We need to
868 // better find whether the inner window should get focus. 868 // better find whether the inner window should get focus.
869 ::SetFocus(constrained_contents_->GetContainerHWND()); 869 ::SetFocus(constrained_contents_->GetContainerHWND());
870 } else { 870 } else {
871 // Give our window the focus so we get keyboard messages. 871 views::View* view_to_focus = NULL;
872 ::SetFocus(GetHWND()); 872 if (window_delegate())
873 view_to_focus = window_delegate()->GetInitiallyFocusedView();
874 if (view_to_focus)
875 view_to_focus->RequestFocus();
876 else // Give our window the focus so we get keyboard messages.
877 ::SetFocus(GetHWND());
873 } 878 }
874 } 879 }
875 } 880 }
876 881
877 void ConstrainedWindowImpl::CloseConstrainedWindow() { 882 void ConstrainedWindowImpl::CloseConstrainedWindow() {
878 // Broadcast to all observers of NOTIFY_CWINDOW_CLOSED. 883 // Broadcast to all observers of NOTIFY_CWINDOW_CLOSED.
879 // One example of such an observer is AutomationCWindowTracker in the 884 // One example of such an observer is AutomationCWindowTracker in the
880 // automation component. 885 // automation component.
881 NotificationService::current()->Notify(NOTIFY_CWINDOW_CLOSED, 886 NotificationService::current()->Notify(NOTIFY_CWINDOW_CLOSED,
882 Source<ConstrainedWindow>(this), 887 Source<ConstrainedWindow>(this),
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 initial_bounds, 1389 initial_bounds,
1385 parent->delegate()->ShouldDisplayURLField()); 1390 parent->delegate()->ShouldDisplayURLField());
1386 1391
1387 window->InitSizeForContents(window_bounds); 1392 window->InitSizeForContents(window_bounds);
1388 1393
1389 // This is a constrained popup window and thus we need to animate it in. 1394 // This is a constrained popup window and thus we need to animate it in.
1390 window->StartSuppressedAnimation(); 1395 window->StartSuppressedAnimation();
1391 1396
1392 return window; 1397 return window;
1393 } 1398 }
OLDNEW
« no previous file with comments | « no previous file | chrome/views/dialog_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698