Arquivos
jcampan@chromium.org e29b47dae1 This CL removes the last (major) Windows specific part out of the focus manager.
It was previously landed and reverted because it broke the reliability tests.
http://codereview.chromium.org/125148

The breakage was caused by constrained windows not getting a hold of the FocusManager when in unparented tabs.
The fix is to ensure unparented tab still have a way to access their FocusManager for proper closure.
Files changed from the previous patch that need reviewing:
native_tab_contents_container_win.cc
tab_contents_view_win.h
tab_contents_view_win.cc

BUG=None
TEST=Run all tests (unit, ui, interactive). Extensively test the focus in Chrome.



Review URL: http://codereview.chromium.org/146093

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19617 0039d316-1c4b-4281-b951-d872f2087c98
2009-06-30 18:48:00 +00:00

64 linhas
1.9 KiB
C++

// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "views/view.h"
#include "app/drag_drop_types.h"
#include "app/gfx/canvas.h"
#include "app/gfx/path.h"
#include "app/os_exchange_data.h"
#include "base/scoped_handle.h"
#include "base/string_util.h"
#include "views/accessibility/view_accessibility_wrapper.h"
#include "views/border.h"
#include "views/widget/root_view.h"
#include "views/widget/widget.h"
namespace views {
void View::DoDrag(const MouseEvent& e, int press_x, int press_y) {
int drag_operations = GetDragOperations(press_x, press_y);
if (drag_operations == DragDropTypes::DRAG_NONE)
return;
scoped_refptr<OSExchangeData> data = new OSExchangeData;
WriteDragData(press_x, press_y, data.get());
// Message the RootView to do the drag and drop. That way if we're removed
// the RootView can detect it and avoid calling us back.
RootView* root_view = GetRootView();
root_view->StartDragForViewFromMouseEvent(this, data, drag_operations);
}
ViewAccessibilityWrapper* View::GetViewAccessibilityWrapper() {
if (accessibility_.get() == NULL) {
accessibility_.reset(new ViewAccessibilityWrapper(this));
}
return accessibility_.get();
}
void View::Focus() {
// Set the native focus to the root view window so it receives the keyboard
// messages.
FocusManager* focus_manager = GetFocusManager();
if (focus_manager)
focus_manager->FocusNativeView(GetRootView()->GetWidget()->GetNativeView());
}
int View::GetHorizontalDragThreshold() {
static int threshold = -1;
if (threshold == -1)
threshold = GetSystemMetrics(SM_CXDRAG) / 2;
return threshold;
}
int View::GetVerticalDragThreshold() {
static int threshold = -1;
if (threshold == -1)
threshold = GetSystemMetrics(SM_CYDRAG) / 2;
return threshold;
}
} // namespace views