summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-12 04:45:08 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-12 04:45:08 +0000
commitd5681e25a5f783677c981d72db0f89509eb836af (patch)
treed3c5d8ede95bd65246b261ce31ba3923f221c619
parenta7e4b326b6312e048651f0e1e3199b09b985453f (diff)
downloadchromium_src-d5681e25a5f783677c981d72db0f89509eb836af.zip
chromium_src-d5681e25a5f783677c981d72db0f89509eb836af.tar.gz
chromium_src-d5681e25a5f783677c981d72db0f89509eb836af.tar.bz2
views: Remove unused windows files.
Most of the _win files are now excluded from the build on windows. So remove them from the tree. Also remove the only remaining instance of USE_AURA in views. BUG=343577 R=sky@chromium.org Review URL: https://codereview.chromium.org/195803002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@256423 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ui/views/controls/link.cc5
-rw-r--r--ui/views/controls/menu/menu_controller_win.cc27
-rw-r--r--ui/views/controls/menu/menu_win.cc573
-rw-r--r--ui/views/controls/menu/menu_win.h139
-rw-r--r--ui/views/focus/focus_manager_unittest_win.cc279
-rw-r--r--ui/views/metrics_win.cc22
-rw-r--r--ui/views/view_win.cc28
-rw-r--r--ui/views/views.gyp105
-rw-r--r--ui/views/win/hwnd_util_win.cc39
9 files changed, 12 insertions, 1205 deletions
diff --git a/ui/views/controls/link.cc b/ui/views/controls/link.cc
index 4d447fd..2ccaa7b 100644
--- a/ui/views/controls/link.cc
+++ b/ui/views/controls/link.cc
@@ -47,12 +47,7 @@ const char* Link::GetClassName() const {
gfx::NativeCursor Link::GetCursor(const ui::MouseEvent& event) {
if (!enabled())
return gfx::kNullCursor;
-#if defined(USE_AURA)
return ui::kCursorHand;
-#elif defined(OS_WIN)
- static HCURSOR g_hand_cursor = LoadCursor(NULL, IDC_HAND);
- return g_hand_cursor;
-#endif
}
bool Link::HitTestRect(const gfx::Rect& rect) const {
diff --git a/ui/views/controls/menu/menu_controller_win.cc b/ui/views/controls/menu/menu_controller_win.cc
deleted file mode 100644
index bbf7e9b..0000000
--- a/ui/views/controls/menu/menu_controller_win.cc
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2012 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 "ui/views/controls/menu/menu_controller.h"
-
-#include "base/run_loop.h"
-#include "ui/gfx/screen.h"
-
-namespace views {
-
-void MenuController::RunMessageLoop(bool nested_menu) {
- base::MessageLoopForUI* loop = base::MessageLoopForUI::current();
- base::MessageLoop::ScopedNestableTaskAllower allow(loop);
- base::RunLoop run_loop(this);
- run_loop.Run();
-}
-
-bool MenuController::ShouldQuitNow() const {
- return true;
-}
-
-gfx::Screen* MenuController::GetScreen() {
- return gfx::Screen::GetNativeScreen();
-}
-
-} // namespace views
diff --git a/ui/views/controls/menu/menu_win.cc b/ui/views/controls/menu/menu_win.cc
deleted file mode 100644
index 8eeba5a..0000000
--- a/ui/views/controls/menu/menu_win.cc
+++ /dev/null
@@ -1,573 +0,0 @@
-// Copyright (c) 2012 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 "ui/views/controls/menu/menu_win.h"
-
-#include <string>
-
-#include "base/logging.h"
-#include "base/stl_util.h"
-#include "base/strings/string_util.h"
-#include "ui/base/accelerators/accelerator.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/l10n/l10n_util_win.h"
-#include "ui/events/keycodes/keyboard_codes.h"
-#include "ui/gfx/canvas.h"
-#include "ui/gfx/font.h"
-#include "ui/gfx/rect.h"
-#include "ui/gfx/win/window_impl.h"
-#include "ui/views/layout/layout_constants.h"
-
-namespace views {
-
-// The width of an icon, including the pixels between the icon and
-// the item label.
-const int kIconWidth = 23;
-// Margins between the top of the item and the label.
-const int kItemTopMargin = 3;
-// Margins between the bottom of the item and the label.
-const int kItemBottomMargin = 4;
-// Margins between the left of the item and the icon.
-const int kItemLeftMargin = 4;
-// The width for displaying the sub-menu arrow.
-const int kArrowWidth = 10;
-
-// Current active MenuHostWindow. If NULL, no menu is active.
-static MenuHostWindow* active_host_window = NULL;
-
-// The data of menu items needed to display.
-struct MenuWin::ItemData {
- base::string16 label;
- gfx::ImageSkia icon;
- bool submenu;
-};
-
-namespace {
-
-static int ChromeGetMenuItemID(HMENU hMenu, int pos) {
- // The built-in Windows GetMenuItemID doesn't work for submenus,
- // so here's our own implementation.
- MENUITEMINFO mii = {0};
- mii.cbSize = sizeof(mii);
- mii.fMask = MIIM_ID;
- GetMenuItemInfo(hMenu, pos, TRUE, &mii);
- return mii.wID;
-}
-
-// MenuHostWindow -------------------------------------------------------------
-
-// MenuHostWindow is the HWND the HMENU is parented to. MenuHostWindow is used
-// to intercept right clicks on the HMENU and notify the delegate as well as
-// for drawing icons.
-//
-class MenuHostWindow : public gfx::WindowImpl {
- public:
- MenuHostWindow(MenuWin* menu, HWND parent_window) : menu_(menu) {
- int extended_style = 0;
- // If the menu needs to be created with a right-to-left UI layout, we must
- // set the appropriate RTL flags (such as WS_EX_LAYOUTRTL) property for the
- // underlying HWND.
- if (menu_->delegate()->IsRightToLeftUILayout())
- extended_style |= l10n_util::GetExtendedStyles();
- set_window_style(WS_CHILD);
- set_window_ex_style(extended_style);
- Init(parent_window, gfx::Rect());
- }
-
- ~MenuHostWindow() {
- DestroyWindow(hwnd());
- }
-
- BEGIN_MSG_MAP_EX(MenuHostWindow);
- MSG_WM_RBUTTONUP(OnRButtonUp)
- MSG_WM_MEASUREITEM(OnMeasureItem)
- MSG_WM_DRAWITEM(OnDrawItem)
- END_MSG_MAP();
-
- private:
- // NOTE: I really REALLY tried to use WM_MENURBUTTONUP, but I ran into
- // two problems in using it:
- // 1. It doesn't contain the coordinates of the mouse.
- // 2. It isn't invoked for menuitems representing a submenu that have children
- // menu items (not empty).
-
- void OnRButtonUp(UINT w_param, const CPoint& loc) {
- int id;
- if (menu_->delegate() && FindMenuIDByLocation(menu_, loc, &id))
- menu_->delegate()->ShowContextMenu(menu_, id, gfx::Point(loc), true);
- }
-
- void OnMeasureItem(WPARAM w_param, MEASUREITEMSTRUCT* lpmis) {
- MenuWin::ItemData* data =
- reinterpret_cast<MenuWin::ItemData*>(lpmis->itemData);
- if (data != NULL) {
- gfx::Font font;
- lpmis->itemWidth = font.GetStringWidth(data->label) + kIconWidth +
- kItemLeftMargin + views::kItemLabelSpacing -
- GetSystemMetrics(SM_CXMENUCHECK);
- if (data->submenu)
- lpmis->itemWidth += kArrowWidth;
- // If the label contains an accelerator, make room for tab.
- if (data->label.find(L'\t') != base::string16::npos)
- lpmis->itemWidth += font.GetStringWidth(L" ");
- lpmis->itemHeight = font.GetHeight() + kItemBottomMargin + kItemTopMargin;
- } else {
- // Measure separator size.
- lpmis->itemHeight = GetSystemMetrics(SM_CYMENU) / 2;
- lpmis->itemWidth = 0;
- }
- }
-
- void OnDrawItem(UINT wParam, DRAWITEMSTRUCT* lpdis) {
- HDC hDC = lpdis->hDC;
- COLORREF prev_bg_color, prev_text_color;
-
- // Set background color and text color
- if (lpdis->itemState & ODS_SELECTED) {
- prev_bg_color = SetBkColor(hDC, GetSysColor(COLOR_HIGHLIGHT));
- prev_text_color = SetTextColor(hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
- } else {
- prev_bg_color = SetBkColor(hDC, GetSysColor(COLOR_MENU));
- if (lpdis->itemState & ODS_DISABLED)
- prev_text_color = SetTextColor(hDC, GetSysColor(COLOR_GRAYTEXT));
- else
- prev_text_color = SetTextColor(hDC, GetSysColor(COLOR_MENUTEXT));
- }
-
- if (lpdis->itemData) {
- MenuWin::ItemData* data =
- reinterpret_cast<MenuWin::ItemData*>(lpdis->itemData);
-
- // Draw the background.
- HBRUSH hbr = CreateSolidBrush(GetBkColor(hDC));
- FillRect(hDC, &lpdis->rcItem, hbr);
- DeleteObject(hbr);
-
- // Draw the label.
- RECT rect = lpdis->rcItem;
- rect.top += kItemTopMargin;
- // Should we add kIconWidth only when icon.width() != 0 ?
- rect.left += kItemLeftMargin + kIconWidth;
- rect.right -= views::kItemLabelSpacing;
- UINT format = DT_TOP | DT_SINGLELINE;
- // Check whether the mnemonics should be underlined.
- BOOL underline_mnemonics;
- SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &underline_mnemonics, 0);
- if (!underline_mnemonics)
- format |= DT_HIDEPREFIX;
- gfx::Font font;
- HGDIOBJ old_font =
- static_cast<HFONT>(SelectObject(hDC, font.GetNativeFont()));
-
- // If an accelerator is specified (with a tab delimiting the rest of the
- // label from the accelerator), we have to justify the fist part on the
- // left and the accelerator on the right.
- // TODO(jungshik): This will break in RTL UI. Currently, he/ar use the
- // window system UI font and will not hit here.
- base::string16 label = data->label;
- base::string16 accel;
- base::string16::size_type tab_pos = label.find(L'\t');
- if (tab_pos != base::string16::npos) {
- accel = label.substr(tab_pos);
- label = label.substr(0, tab_pos);
- }
- DrawTextEx(hDC, const_cast<wchar_t*>(label.data()),
- static_cast<int>(label.size()), &rect, format | DT_LEFT, NULL);
- if (!accel.empty())
- DrawTextEx(hDC, const_cast<wchar_t*>(accel.data()),
- static_cast<int>(accel.size()), &rect,
- format | DT_RIGHT, NULL);
- SelectObject(hDC, old_font);
-
- // Draw the icon after the label, otherwise it would be covered
- // by the label.
- gfx::ImageSkiaRep icon_image_rep = data->icon.GetRepresentation(1.0f);
- if (data->icon.width() != 0 && data->icon.height() != 0) {
- gfx::Canvas canvas(icon_image_rep, false);
- skia::DrawToNativeContext(
- canvas.sk_canvas(), hDC, lpdis->rcItem.left + kItemLeftMargin,
- lpdis->rcItem.top + (lpdis->rcItem.bottom - lpdis->rcItem.top -
- data->icon.height()) / 2, NULL);
- }
-
- } else {
- // Draw the separator
- lpdis->rcItem.top += (lpdis->rcItem.bottom - lpdis->rcItem.top) / 3;
- DrawEdge(hDC, &lpdis->rcItem, EDGE_ETCHED, BF_TOP);
- }
-
- SetBkColor(hDC, prev_bg_color);
- SetTextColor(hDC, prev_text_color);
- }
-
- bool FindMenuIDByLocation(MenuWin* menu, const CPoint& loc, int* id) {
- int index = MenuItemFromPoint(NULL, menu->menu_, loc);
- if (index != -1) {
- *id = ChromeGetMenuItemID(menu->menu_, index);
- return true;
- } else {
- for (std::vector<MenuWin*>::iterator i = menu->submenus_.begin();
- i != menu->submenus_.end(); ++i) {
- if (FindMenuIDByLocation(*i, loc, id))
- return true;
- }
- }
- return false;
- }
-
- // The menu that created us.
- MenuWin* menu_;
-
- DISALLOW_COPY_AND_ASSIGN(MenuHostWindow);
-};
-
-} // namespace
-
-// static
-Menu* Menu::Create(Delegate* delegate,
- AnchorPoint anchor,
- gfx::NativeView parent) {
- return new MenuWin(delegate, anchor, parent);
-}
-
-// static
-Menu* Menu::GetSystemMenu(gfx::NativeWindow parent) {
- return new views::MenuWin(::GetSystemMenu(parent, FALSE));
-}
-
-MenuWin::MenuWin(Delegate* d, AnchorPoint anchor, HWND owner)
- : Menu(d, anchor),
- menu_(CreatePopupMenu()),
- owner_(owner),
- is_menu_visible_(false),
- owner_draw_(l10n_util::NeedOverrideDefaultUIFont(NULL, NULL)) {
- DCHECK(delegate());
-}
-
-MenuWin::MenuWin(HMENU hmenu)
- : Menu(NULL, TOPLEFT),
- menu_(hmenu),
- owner_(NULL),
- is_menu_visible_(false),
- owner_draw_(false) {
- DCHECK(menu_);
-}
-
-MenuWin::~MenuWin() {
- STLDeleteContainerPointers(submenus_.begin(), submenus_.end());
- STLDeleteContainerPointers(item_data_.begin(), item_data_.end());
- DestroyMenu(menu_);
-}
-
-void MenuWin::AddMenuItemWithIcon(int index,
- int item_id,
- const base::string16& label,
- const gfx::ImageSkia& icon) {
- owner_draw_ = true;
- Menu::AddMenuItemWithIcon(index, item_id, label, icon);
-}
-
-Menu* MenuWin::AddSubMenuWithIcon(int index,
- int item_id,
- const base::string16& label,
- const gfx::ImageSkia& icon) {
- MenuWin* submenu = new MenuWin(this);
- submenus_.push_back(submenu);
- AddMenuItemInternal(index, item_id, label, icon, submenu->menu_, NORMAL);
- return submenu;
-}
-
-void MenuWin::AddSeparator(int index) {
- MENUITEMINFO mii;
- mii.cbSize = sizeof(mii);
- mii.fMask = MIIM_FTYPE;
- mii.fType = MFT_SEPARATOR;
- InsertMenuItem(menu_, index, TRUE, &mii);
-}
-
-void MenuWin::EnableMenuItemByID(int item_id, bool enabled) {
- UINT enable_flags = enabled ? MF_ENABLED : MF_DISABLED | MF_GRAYED;
- EnableMenuItem(menu_, item_id, MF_BYCOMMAND | enable_flags);
-}
-
-void MenuWin::EnableMenuItemAt(int index, bool enabled) {
- UINT enable_flags = enabled ? MF_ENABLED : MF_DISABLED | MF_GRAYED;
- EnableMenuItem(menu_, index, MF_BYPOSITION | enable_flags);
-}
-
-void MenuWin::SetMenuLabel(int item_id, const base::string16& label) {
- MENUITEMINFO mii = {0};
- mii.cbSize = sizeof(mii);
- mii.fMask = MIIM_STRING;
- mii.dwTypeData = const_cast<wchar_t*>(label.c_str());
- mii.cch = static_cast<UINT>(label.size());
- SetMenuItemInfo(menu_, item_id, false, &mii);
-}
-
-bool MenuWin::SetIcon(const gfx::ImageSkia& icon, int item_id) {
- if (!owner_draw_)
- owner_draw_ = true;
-
- const int num_items = GetMenuItemCount(menu_);
- int sep_count = 0;
- for (int i = 0; i < num_items; ++i) {
- if (!(GetMenuState(menu_, i, MF_BYPOSITION) & MF_SEPARATOR)) {
- if (ChromeGetMenuItemID(menu_, i) == item_id) {
- item_data_[i - sep_count]->icon = icon;
- // When the menu is running, we use SetMenuItemInfo to let Windows
- // update the item information so that the icon being displayed
- // could change immediately.
- if (active_host_window) {
- MENUITEMINFO mii;
- mii.cbSize = sizeof(mii);
- mii.fMask = MIIM_FTYPE | MIIM_DATA;
- mii.fType = MFT_OWNERDRAW;
- mii.dwItemData =
- reinterpret_cast<ULONG_PTR>(item_data_[i - sep_count]);
- SetMenuItemInfo(menu_, item_id, false, &mii);
- }
- return true;
- }
- } else {
- ++sep_count;
- }
- }
-
- // Continue searching for the item in submenus.
- for (size_t i = 0; i < submenus_.size(); ++i) {
- if (submenus_[i]->SetIcon(icon, item_id))
- return true;
- }
-
- return false;
-}
-
-void MenuWin::RunMenuAt(int x, int y) {
- SetMenuInfo();
-
- delegate()->MenuWillShow();
-
- // NOTE: we don't use TPM_RIGHTBUTTON here as it breaks selecting by way of
- // press, drag, release. See bugs 718 and 8560.
- UINT flags =
- GetTPMAlignFlags() | TPM_LEFTBUTTON | TPM_RETURNCMD | TPM_RECURSE;
- is_menu_visible_ = true;
- DCHECK(owner_);
- // In order for context menus on menus to work, the context menu needs to
- // share the same window as the first menu is parented to.
- bool created_host = false;
- if (!active_host_window) {
- created_host = true;
- active_host_window = new MenuHostWindow(this, owner_);
- }
- UINT selected_id =
- TrackPopupMenuEx(menu_, flags, x, y, active_host_window->hwnd(), NULL);
- if (created_host) {
- delete active_host_window;
- active_host_window = NULL;
- }
- is_menu_visible_ = false;
-
- // Execute the chosen command
- if (selected_id != 0)
- delegate()->ExecuteCommand(selected_id);
-}
-
-void MenuWin::Cancel() {
- DCHECK(is_menu_visible_);
- EndMenu();
-}
-
-int MenuWin::ItemCount() {
- return GetMenuItemCount(menu_);
-}
-
-void MenuWin::AddMenuItemInternal(int index,
- int item_id,
- const base::string16& label,
- const gfx::ImageSkia& icon,
- MenuItemType type) {
- AddMenuItemInternal(index, item_id, label, icon, NULL, type);
-}
-
-void MenuWin::AddMenuItemInternal(int index,
- int item_id,
- const base::string16& label,
- const gfx::ImageSkia& icon,
- HMENU submenu,
- MenuItemType type) {
- DCHECK(type != SEPARATOR) << "Call AddSeparator instead!";
-
- if (!owner_draw_ && !icon.isNull())
- owner_draw_ = true;
-
- if (label.empty() && !delegate()) {
- // No label and no delegate; don't add an empty menu.
- // It appears under some circumstance we're getting an empty label
- // (l10n_util::GetStringUTF16(IDS_TASK_MANAGER) returns ""). This shouldn't
- // happen, but I'm working over the crash here.
- NOTREACHED();
- return;
- }
-
- MENUITEMINFO mii;
- mii.cbSize = sizeof(mii);
- mii.fMask = MIIM_FTYPE | MIIM_ID;
- if (submenu) {
- mii.fMask |= MIIM_SUBMENU;
- mii.hSubMenu = submenu;
- }
-
- // Set the type and ID.
- if (!owner_draw_) {
- mii.fType = MFT_STRING;
- mii.fMask |= MIIM_STRING;
- } else {
- mii.fType = MFT_OWNERDRAW;
- }
-
- if (type == RADIO)
- mii.fType |= MFT_RADIOCHECK;
-
- mii.wID = item_id;
-
- // Set the item data.
- MenuWin::ItemData* data = new ItemData;
- item_data_.push_back(data);
- data->submenu = submenu != NULL;
-
- base::string16 actual_label(
- label.empty() ? delegate()->GetLabel(item_id) : label);
-
- // Find out if there is a shortcut we need to append to the label.
- ui::Accelerator accelerator(ui::VKEY_UNKNOWN, ui::EF_NONE);
- if (delegate() && delegate()->GetAcceleratorInfo(item_id, &accelerator)) {
- actual_label += L'\t';
- actual_label += accelerator.GetShortcutText();
- }
- labels_.push_back(actual_label);
-
- if (owner_draw_) {
- if (icon.width() != 0 && icon.height() != 0)
- data->icon = icon;
- else
- data->icon = delegate()->GetIcon(item_id);
- } else {
- mii.dwTypeData = const_cast<wchar_t*>(labels_.back().c_str());
- }
-
- InsertMenuItem(menu_, index, TRUE, &mii);
-}
-
-MenuWin::MenuWin(MenuWin* parent)
- : Menu(parent->delegate(), parent->anchor()),
- menu_(CreatePopupMenu()),
- owner_(parent->owner_),
- is_menu_visible_(false),
- owner_draw_(parent->owner_draw_) {
-}
-
-void MenuWin::SetMenuInfo() {
- const int num_items = GetMenuItemCount(menu_);
- int sep_count = 0;
- for (int i = 0; i < num_items; ++i) {
- MENUITEMINFO mii_info;
- mii_info.cbSize = sizeof(mii_info);
- // Get the menu's original type.
- mii_info.fMask = MIIM_FTYPE;
- GetMenuItemInfo(menu_, i, MF_BYPOSITION, &mii_info);
- // Set item states.
- if (!(mii_info.fType & MF_SEPARATOR)) {
- const int id = ChromeGetMenuItemID(menu_, i);
-
- MENUITEMINFO mii;
- mii.cbSize = sizeof(mii);
- mii.fMask = MIIM_STATE | MIIM_FTYPE | MIIM_DATA | MIIM_STRING;
- // We also need MFT_STRING for owner drawn items in order to let Windows
- // handle the accelerators for us.
- mii.fType = MFT_STRING;
- if (owner_draw_)
- mii.fType |= MFT_OWNERDRAW;
- // If the menu originally has radiocheck type, we should follow it.
- if (mii_info.fType & MFT_RADIOCHECK)
- mii.fType |= MFT_RADIOCHECK;
- mii.fState = GetStateFlagsForItemID(id);
-
- // Validate the label. If there is a contextual label, use it, otherwise
- // default to the static label
- base::string16 label;
- if (!delegate()->GetContextualLabel(id, &label))
- label = labels_[i - sep_count];
-
- if (owner_draw_) {
- item_data_[i - sep_count]->label = label;
- mii.dwItemData = reinterpret_cast<ULONG_PTR>(item_data_[i - sep_count]);
- }
- mii.dwTypeData = const_cast<wchar_t*>(label.c_str());
- mii.cch = static_cast<UINT>(label.size());
- SetMenuItemInfo(menu_, i, true, &mii);
- } else {
- // Set data for owner drawn separators. Set dwItemData NULL to indicate
- // a separator.
- if (owner_draw_) {
- MENUITEMINFO mii;
- mii.cbSize = sizeof(mii);
- mii.fMask = MIIM_FTYPE;
- mii.fType = MFT_SEPARATOR | MFT_OWNERDRAW;
- mii.dwItemData = NULL;
- SetMenuItemInfo(menu_, i, true, &mii);
- }
- ++sep_count;
- }
- }
-
- for (size_t i = 0; i < submenus_.size(); ++i)
- submenus_[i]->SetMenuInfo();
-}
-
-UINT MenuWin::GetStateFlagsForItemID(int item_id) const {
- // Use the delegate to get enabled and checked state.
- UINT flags =
- delegate()->IsCommandEnabled(item_id) ? MFS_ENABLED : MFS_DISABLED;
-
- if (delegate()->IsItemChecked(item_id))
- flags |= MFS_CHECKED;
-
- if (delegate()->IsItemDefault(item_id))
- flags |= MFS_DEFAULT;
-
- return flags;
-}
-
-DWORD MenuWin::GetTPMAlignFlags() const {
- // The manner in which we handle the menu alignment depends on whether or not
- // the menu is displayed within a mirrored view. If the UI is mirrored, the
- // alignment needs to be fliped so that instead of aligning the menu to the
- // right of the point, we align it to the left and vice versa.
- DWORD align_flags = TPM_TOPALIGN;
- switch (anchor()) {
- case TOPLEFT:
- if (delegate()->IsRightToLeftUILayout()) {
- align_flags |= TPM_RIGHTALIGN;
- } else {
- align_flags |= TPM_LEFTALIGN;
- }
- break;
-
- case TOPRIGHT:
- if (delegate()->IsRightToLeftUILayout()) {
- align_flags |= TPM_LEFTALIGN;
- } else {
- align_flags |= TPM_RIGHTALIGN;
- }
- break;
-
- default:
- NOTREACHED();
- return 0;
- }
- return align_flags;
-}
-
-} // namespace views
diff --git a/ui/views/controls/menu/menu_win.h b/ui/views/controls/menu/menu_win.h
deleted file mode 100644
index 7e0a127..0000000
--- a/ui/views/controls/menu/menu_win.h
+++ /dev/null
@@ -1,139 +0,0 @@
-// Copyright (c) 2012 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.
-
-#ifndef UI_VIEWS_CONTROLS_MENU_MENU_WIN_H_
-#define UI_VIEWS_CONTROLS_MENU_MENU_WIN_H_
-
-#include <windows.h>
-
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
-#include "ui/views/controls/menu/menu.h"
-
-namespace views {
-
-namespace {
-class MenuHostWindow;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// Menu class
-//
-// A wrapper around a Win32 HMENU handle that provides convenient APIs for
-// menu construction, display and subsequent command execution.
-//
-///////////////////////////////////////////////////////////////////////////////
-class MenuWin : public Menu {
- public:
- // Construct a Menu using the specified controller to determine command
- // state.
- // delegate A Menu::Delegate implementation that provides more
- // information about the Menu presentation.
- // anchor An alignment hint for the popup menu.
- // owner The window that the menu is being brought up relative
- // to. Not actually used for anything but must not be
- // NULL.
- MenuWin(Delegate* d, AnchorPoint anchor, HWND owner);
- // Alternatively, a Menu object can be constructed wrapping an existing
- // HMENU. This can be used to use the convenience methods to insert
- // menu items and manage label string ownership. However this kind of
- // Menu object cannot use the delegate.
- explicit MenuWin(HMENU hmenu);
- virtual ~MenuWin();
-
- // Overridden from Menu:
- virtual void AddMenuItemWithIcon(int index,
- int item_id,
- const base::string16& label,
- const gfx::ImageSkia& icon) OVERRIDE;
- virtual Menu* AddSubMenuWithIcon(int index,
- int item_id,
- const base::string16& label,
- const gfx::ImageSkia& icon) OVERRIDE;
- virtual void AddSeparator(int index) OVERRIDE;
- virtual void EnableMenuItemByID(int item_id, bool enabled) OVERRIDE;
- virtual void EnableMenuItemAt(int index, bool enabled) OVERRIDE;
- virtual void SetMenuLabel(int item_id, const base::string16& label) OVERRIDE;
- virtual bool SetIcon(const gfx::ImageSkia& icon, int item_id) OVERRIDE;
- virtual void RunMenuAt(int x, int y) OVERRIDE;
- virtual void Cancel() OVERRIDE;
- virtual int ItemCount() OVERRIDE;
-
- virtual HMENU GetMenuHandle() const {
- return menu_;
- }
-
- // Gets the Win32 TPM alignment flags for the specified AnchorPoint.
- DWORD GetTPMAlignFlags() const;
-
- protected:
- virtual void AddMenuItemInternal(int index,
- int item_id,
- const base::string16& label,
- const gfx::ImageSkia& icon,
- MenuItemType type) OVERRIDE;
-
- private:
- friend class MenuHostWindow;
-
- // The data of menu items needed to display.
- struct ItemData;
-
- void AddMenuItemInternal(int index,
- int item_id,
- const base::string16& label,
- const gfx::ImageSkia& icon,
- HMENU submenu,
- MenuItemType type);
-
- explicit MenuWin(MenuWin* parent);
-
- // Sets menu information before displaying, including sub-menus.
- void SetMenuInfo();
-
- // Get all the state flags for the |fState| field of MENUITEMINFO for the
- // item with the specified id. |delegate| is consulted if non-NULL about
- // the state of the item in preference to |controller_|.
- UINT GetStateFlagsForItemID(int item_id) const;
-
- // The Win32 Menu Handle we wrap
- HMENU menu_;
-
- // The window that would receive WM_COMMAND messages when the user selects
- // an item from the menu.
- HWND owner_;
-
- // This list is used to store the default labels for the menu items.
- // We may use contextual labels when RunMenu is called, so we must save
- // a copy of default ones here.
- std::vector<base::string16> labels_;
-
- // A flag to indicate whether this menu will be drawn by the Menu class.
- // If it's true, all the menu items will be owner drawn. Otherwise,
- // all the drawing will be done by Windows.
- bool owner_draw_;
-
- // This list is to store the string labels and icons to display. It's used
- // when owner_draw_ is true. We give MENUITEMINFO pointers to these
- // structures to specify what we'd like to draw. If owner_draw_ is false,
- // we only give MENUITEMINFO pointers to the labels_.
- // The label member of the ItemData structure comes from either labels_ or
- // the GetContextualLabel.
- std::vector<ItemData*> item_data_;
-
- // Our sub-menus, if any.
- std::vector<MenuWin*> submenus_;
-
- // Whether the menu is visible.
- bool is_menu_visible_;
-
- DISALLOW_COPY_AND_ASSIGN(MenuWin);
-};
-
-} // namespace views
-
-#endif // UI_VIEWS_CONTROLS_MENU_MENU_WIN_H_
diff --git a/ui/views/focus/focus_manager_unittest_win.cc b/ui/views/focus/focus_manager_unittest_win.cc
deleted file mode 100644
index 651b5f3..0000000
--- a/ui/views/focus/focus_manager_unittest_win.cc
+++ /dev/null
@@ -1,279 +0,0 @@
-// Copyright (c) 2012 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 "ui/views/focus/focus_manager.h"
-
-#include "base/memory/scoped_ptr.h"
-#include "base/run_loop.h"
-#include "base/strings/utf_string_conversions.h"
-#include "ui/events/event.h"
-#include "ui/views/controls/button/label_button.h"
-#include "ui/views/focus/focus_manager_test.h"
-#include "ui/views/widget/widget.h"
-
-namespace views {
-
-namespace {
-
-class MessageTrackingView : public View {
- public:
- MessageTrackingView() : accelerator_pressed_(false) {
- }
-
- void Reset() {
- accelerator_pressed_ = false;
- keys_pressed_.clear();
- keys_released_.clear();
- }
-
- const std::vector<ui::KeyboardCode>& keys_pressed() const {
- return keys_pressed_;
- }
-
- const std::vector<ui::KeyboardCode>& keys_released() const {
- return keys_released_;
- }
-
- bool accelerator_pressed() const {
- return accelerator_pressed_;
- }
-
- // Overridden from View:
- virtual bool OnKeyPressed(const ui::KeyEvent& e) OVERRIDE {
- keys_pressed_.push_back(e.key_code());
- return true;
- }
- virtual bool OnKeyReleased(const ui::KeyEvent& e) OVERRIDE {
- keys_released_.push_back(e.key_code());
- return true;
- }
- virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE {
- accelerator_pressed_ = true;
- return true;
- }
-
- private:
- bool accelerator_pressed_;
- std::vector<ui::KeyboardCode> keys_pressed_;
- std::vector<ui::KeyboardCode> keys_released_;
-
- DISALLOW_COPY_AND_ASSIGN(MessageTrackingView);
-};
-
-} // namespace
-
-// Test that when activating/deactivating the top window, the focus is stored/
-// restored properly.
-TEST_F(FocusManagerTest, FocusStoreRestore) {
- // Simulate an activate, otherwise the deactivate isn't going to do anything.
- SimulateActivateWindow();
-
- LabelButton* button = new LabelButton(NULL, base::ASCIIToUTF16("Press me"));
- button->SetStyle(Button::STYLE_BUTTON);
- View* view = new View();
- view->SetFocusable(true);
-
- GetContentsView()->AddChildView(button);
- button->SetBounds(10, 10, 200, 30);
- GetContentsView()->AddChildView(view);
- RunPendingMessages();
-
- TestFocusChangeListener listener;
- AddFocusChangeListener(&listener);
-
- view->RequestFocus();
- RunPendingMessages();
-
- // Required for VS2010: http://connect.microsoft.com/VisualStudio/feedback/details/520043/error-converting-from-null-to-a-pointer-type-in-std-pair
- views::View* null_view = NULL;
-
- // Deacivate the window, it should store its focus.
- SimulateDeactivateWindow();
- EXPECT_EQ(NULL, GetFocusManager()->GetFocusedView());
- ASSERT_EQ(2, static_cast<int>(listener.focus_changes().size()));
- EXPECT_TRUE(listener.focus_changes()[0] == ViewPair(null_view, view));
- EXPECT_TRUE(listener.focus_changes()[1] == ViewPair(view, null_view));
- listener.ClearFocusChanges();
-
- // Reactivate, focus should come-back to the previously focused view.
- SimulateActivateWindow();
- EXPECT_EQ(view, GetFocusManager()->GetFocusedView());
- ASSERT_EQ(1, static_cast<int>(listener.focus_changes().size()));
- EXPECT_TRUE(listener.focus_changes()[0] == ViewPair(null_view, view));
- listener.ClearFocusChanges();
-
- // Same test with a NativeControl.
- button->RequestFocus();
- SimulateDeactivateWindow();
- EXPECT_EQ(NULL, GetFocusManager()->GetFocusedView());
- ASSERT_EQ(2, static_cast<int>(listener.focus_changes().size()));
- EXPECT_TRUE(listener.focus_changes()[0] == ViewPair(view, button));
- EXPECT_TRUE(listener.focus_changes()[1] == ViewPair(button, null_view));
- listener.ClearFocusChanges();
-
- SimulateActivateWindow();
- EXPECT_EQ(button, GetFocusManager()->GetFocusedView());
- ASSERT_EQ(1, static_cast<int>(listener.focus_changes().size()));
- EXPECT_TRUE(listener.focus_changes()[0] == ViewPair(null_view, button));
- listener.ClearFocusChanges();
-
- /*
- // Now test that while the window is inactive we can change the focused view
- // (we do that in several places).
- SimulateDeactivateWindow();
- // TODO: would have to mock the window being inactive (with a TestWidgetWin
- // that would return false on IsActive()).
- GetFocusManager()->SetFocusedView(view);
- ::SendMessage(window_->GetNativeWindow(), WM_ACTIVATE, WA_ACTIVE, NULL);
-
- EXPECT_EQ(view, GetFocusManager()->GetFocusedView());
- ASSERT_EQ(2, static_cast<int>(listener.focus_changes().size()));
- EXPECT_TRUE(listener.focus_changes()[0] == ViewPair(button, null_view));
- EXPECT_TRUE(listener.focus_changes()[1] == ViewPair(null_view, view));
- */
-}
-
-// Test that the focus manager is created successfully for the first view
-// window parented to a native dialog.
-TEST_F(FocusManagerTest, CreationForNativeRoot) {
- // Create a window class.
- WNDCLASSEX class_ex;
- memset(&class_ex, 0, sizeof(class_ex));
- class_ex.cbSize = sizeof(WNDCLASSEX);
- class_ex.lpfnWndProc = &DefWindowProc;
- class_ex.lpszClassName = L"TestWindow";
- ATOM atom = RegisterClassEx(&class_ex);
- ASSERT_TRUE(atom);
-
- // Create a native dialog window.
- HWND hwnd = CreateWindowEx(0, class_ex.lpszClassName, NULL,
- WS_OVERLAPPEDWINDOW, 0, 0, 200, 200,
- NULL, NULL, NULL, NULL);
- ASSERT_TRUE(hwnd);
-
- // Create a view window parented to native dialog.
- scoped_ptr<Widget> widget1(new Widget);
- Widget::InitParams params(Widget::InitParams::TYPE_CONTROL);
- params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
- params.parent = hwnd;
- params.bounds = gfx::Rect(0, 0, 100, 100);
- params.top_level = true; // This is top level in views hierarchy.
- widget1->Init(params);
-
- // Get the focus manager directly from the first window. Should exist
- // because the first window is the root widget.
- views::FocusManager* focus_manager1 = widget1->GetFocusManager();
- EXPECT_TRUE(focus_manager1);
-
- // Create another view window parented to the first view window.
- scoped_ptr<Widget> widget2(new Widget);
- params.parent = widget1->GetNativeView();
- params.top_level = false; // This is child widget.
- widget2->Init(params);
-
- // Access the shared focus manager directly from the second window.
- views::FocusManager* focus_manager2 = widget2->GetFocusManager();
- EXPECT_EQ(focus_manager2, focus_manager1);
-
- // Access the shared focus manager indirectly from the first window handle.
- gfx::NativeWindow native_window = widget1->GetNativeWindow();
- views::Widget* widget =
- views::Widget::GetWidgetForNativeWindow(native_window);
- EXPECT_EQ(widget->GetFocusManager(), focus_manager1);
-
- // Access the shared focus manager indirectly from the second window handle.
- native_window = widget2->GetNativeWindow();
- widget = views::Widget::GetWidgetForNativeWindow(native_window);
- EXPECT_EQ(widget->GetFocusManager(), focus_manager1);
-
- // Access the shared focus manager indirectly from the first view handle.
- gfx::NativeView native_view = widget1->GetNativeView();
- widget = views::Widget::GetTopLevelWidgetForNativeView(native_view);
- EXPECT_EQ(widget->GetFocusManager(), focus_manager1);
-
- // Access the shared focus manager indirectly from the second view handle.
- native_view = widget2->GetNativeView();
- widget = views::Widget::GetTopLevelWidgetForNativeView(native_view);
- EXPECT_EQ(widget->GetFocusManager(), focus_manager1);
-
- DestroyWindow(hwnd);
-}
-
-// Tests that the keyup messages are eaten for accelerators.
-// Windows-only, Windows is the only platform that handles accelerators in
-// AcceleratorHandler. NativeWidgetAura::OnKeyEvent handles them in other
-// configurations.
-TEST_F(FocusManagerTest, IgnoreKeyupForAccelerators) {
- FocusManager* focus_manager = GetFocusManager();
- MessageTrackingView* mtv = new MessageTrackingView();
- mtv->AddAccelerator(ui::Accelerator(ui::VKEY_0, ui::EF_NONE));
- mtv->AddAccelerator(ui::Accelerator(ui::VKEY_1, ui::EF_NONE));
- GetContentsView()->AddChildView(mtv);
- focus_manager->SetFocusedView(mtv);
-
- // First send a non-accelerator key sequence.
- PostKeyDown(ui::VKEY_9);
- PostKeyUp(ui::VKEY_9);
- scoped_ptr<base::RunLoop> run_loop(new base::RunLoop());
- run_loop->RunUntilIdle();
- // Make sure we get a key-up and key-down.
- ASSERT_EQ(1U, mtv->keys_pressed().size());
- EXPECT_EQ(ui::VKEY_9, mtv->keys_pressed()[0]);
- ASSERT_EQ(1U, mtv->keys_released().size());
- EXPECT_EQ(ui::VKEY_9, mtv->keys_released()[0]);
- EXPECT_FALSE(mtv->accelerator_pressed());
- mtv->Reset();
-
- // Same thing with repeat and more than one key at once.
- PostKeyDown(ui::VKEY_9);
- PostKeyDown(ui::VKEY_9);
- PostKeyDown(ui::VKEY_8);
- PostKeyDown(ui::VKEY_9);
- PostKeyDown(ui::VKEY_7);
- PostKeyUp(ui::VKEY_9);
- PostKeyUp(ui::VKEY_7);
- PostKeyUp(ui::VKEY_8);
- run_loop.reset(new base::RunLoop());
- run_loop->RunUntilIdle();
- // Make sure we get a key-up and key-down.
- ASSERT_EQ(5U, mtv->keys_pressed().size());
- EXPECT_EQ(ui::VKEY_9, mtv->keys_pressed()[0]);
- EXPECT_EQ(ui::VKEY_9, mtv->keys_pressed()[1]);
- EXPECT_EQ(ui::VKEY_8, mtv->keys_pressed()[2]);
- EXPECT_EQ(ui::VKEY_9, mtv->keys_pressed()[3]);
- EXPECT_EQ(ui::VKEY_7, mtv->keys_pressed()[4]);
- ASSERT_EQ(3U, mtv->keys_released().size());
- EXPECT_EQ(ui::VKEY_9, mtv->keys_released()[0]);
- EXPECT_EQ(ui::VKEY_7, mtv->keys_released()[1]);
- EXPECT_EQ(ui::VKEY_8, mtv->keys_released()[2]);
- EXPECT_FALSE(mtv->accelerator_pressed());
- mtv->Reset();
-
- // Now send an accelerator key sequence.
- PostKeyDown(ui::VKEY_0);
- PostKeyUp(ui::VKEY_0);
- run_loop.reset(new base::RunLoop());
- run_loop->RunUntilIdle();
- EXPECT_TRUE(mtv->keys_pressed().empty());
- EXPECT_TRUE(mtv->keys_released().empty());
- EXPECT_TRUE(mtv->accelerator_pressed());
- mtv->Reset();
-
- // Same thing with repeat and more than one key at once.
- PostKeyDown(ui::VKEY_0);
- PostKeyDown(ui::VKEY_1);
- PostKeyDown(ui::VKEY_1);
- PostKeyDown(ui::VKEY_0);
- PostKeyDown(ui::VKEY_0);
- PostKeyUp(ui::VKEY_1);
- PostKeyUp(ui::VKEY_0);
- run_loop.reset(new base::RunLoop());
- run_loop->RunUntilIdle();
- EXPECT_TRUE(mtv->keys_pressed().empty());
- EXPECT_TRUE(mtv->keys_released().empty());
- EXPECT_TRUE(mtv->accelerator_pressed());
- mtv->Reset();
-}
-
-} // namespace views
diff --git a/ui/views/metrics_win.cc b/ui/views/metrics_win.cc
deleted file mode 100644
index 3e04446..0000000
--- a/ui/views/metrics_win.cc
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (c) 2011 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 "ui/views/metrics.h"
-
-#include <windows.h>
-
-namespace views {
-
-int GetDoubleClickInterval() {
- return ::GetDoubleClickTime();
-}
-
-int GetMenuShowDelay() {
- static DWORD delay = 0;
- if (!delay && !SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &delay, 0))
- delay = kDefaultMenuShowDelay;
- return delay;
-}
-
-} // namespace views
diff --git a/ui/views/view_win.cc b/ui/views/view_win.cc
deleted file mode 100644
index 183a775..0000000
--- a/ui/views/view_win.cc
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) 2011 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 "ui/views/view.h"
-
-// Necessary to define oleacc GUID's.
-#include <windows.h>
-#include <initguid.h>
-#include <oleacc.h>
-
-namespace views {
-
-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
diff --git a/ui/views/views.gyp b/ui/views/views.gyp
index 8aac087..81124a1 100644
--- a/ui/views/views.gyp
+++ b/ui/views/views.gyp
@@ -7,10 +7,6 @@
},
'target_defaults': {
'conditions': [
- ['use_aura==1', {
- 'sources/': [ ['exclude', '_win\\.(h|cc)$'] ],
- 'dependencies': [ '../aura/aura.gyp:aura', ],
- }],
['OS!="linux" or chromeos==1', {
'sources/': [ ['exclude', '_linux\\.(h|cc)$'] ],
}],
@@ -30,6 +26,7 @@
'../../url/url.gyp:url_lib',
'../accessibility/accessibility.gyp:accessibility',
'../accessibility/accessibility.gyp:ax_gen',
+ '../aura/aura.gyp:aura',
'../base/strings/ui_strings.gyp:ui_strings',
'../compositor/compositor.gyp:compositor',
'../events/events.gyp:events',
@@ -129,7 +126,6 @@
'controls/menu/menu_controller.h',
'controls/menu/menu_controller_aura.cc',
'controls/menu/menu_controller_delegate.h',
- 'controls/menu/menu_controller_win.cc',
'controls/menu/menu_delegate.cc',
'controls/menu/menu_delegate.h',
'controls/menu/menu_host.cc',
@@ -151,8 +147,6 @@
'controls/menu/menu_separator.h',
'controls/menu/menu_separator_views.cc',
'controls/menu/menu_separator_win.cc',
- 'controls/menu/menu_win.cc',
- 'controls/menu/menu_win.h',
'controls/menu/menu_wrapper.h',
'controls/menu/native_menu_win.cc',
'controls/menu/native_menu_win.h',
@@ -282,7 +276,6 @@
'metrics.cc',
'metrics.h',
'metrics_aura.cc',
- 'metrics_win.cc',
'mouse_constants.h',
'mouse_watcher.cc',
'mouse_watcher.h',
@@ -314,7 +307,6 @@
'view_model.h',
'view_model_utils.cc',
'view_model_utils.h',
- 'view_win.cc',
'views_switches.cc',
'views_switches.h',
'views_delegate.cc',
@@ -405,7 +397,6 @@
'win/hwnd_message_handler_delegate.h',
'win/hwnd_util.h',
'win/hwnd_util_aurawin.cc',
- 'win/hwnd_util_win.cc',
'win/scoped_fullscreen_visibility.cc',
'win/scoped_fullscreen_visibility.h',
'window/client_view.cc',
@@ -474,40 +465,6 @@
'../../third_party/wtl/include',
],
'conditions': [
- ['use_aura==1', {
- 'conditions': [
- ['OS=="win"', {
- 'sources/': [
- ['include', 'controls/menu/menu_insertion_delegate_win.h'],
- ['include', 'controls/menu/native_menu_win.cc'],
- ['include', 'controls/menu/native_menu_win.h'],
- ['include', 'corewm/tooltip_win.cc'],
- ['include', 'corewm/tooltip_win.h'],
- ['include', 'event_utils_win.cc'],
- ['include', 'widget/desktop_aura/desktop_screen_win.cc'],
- ['include', 'widget/desktop_aura/desktop_drag_drop_client_win.cc'],
- ['include', 'widget/desktop_aura/desktop_drop_target_win.cc'],
- ['include', 'widget/desktop_aura/desktop_window_tree_host_win.cc'],
- ['include', 'widget/monitor_win.cc'],
- ['include', 'widget/monitor_win.h'],
- ['include', 'win/appbar.cc'],
- ['include', 'win/appbar.h'],
- ],
- }],
- ],
- }],
- ['use_aura==0', {
- 'sources/': [
- ['exclude', 'corewm'],
- ['exclude', 'widget/desktop_aura'],
- ['exclude', 'widget/window_reorderer.h'],
- ['exclude', 'widget/window_reorderer.cc'],
- ],
- 'sources!': [
- 'widget/widget_aura_utils.cc',
- 'widget/widget_aura_utils.h',
- ],
- }],
['chromeos==1', {
'sources/': [
['exclude', 'widget/desktop_aura'],
@@ -519,20 +476,6 @@
'bubble/tray_bubble_view.h',
],
}],
- ['use_aura==0 and OS=="win"', {
- 'sources!': [
- 'controls/menu/menu_config_views.cc',
- 'controls/menu/menu_separator_views.cc',
- ],
- }],
- ['use_aura==1 and OS=="win"', {
- 'sources/': [
- ['include', 'controls/menu/menu_config_win.cc'],
- ['include', 'controls/menu/menu_separator_win.cc'],
- ['include', 'accessibility/native_view_accessibility_win.cc'],
- ['include', 'accessibility/native_view_accessibility_win.h'],
- ],
- }],
['OS=="linux" and chromeos==0', {
'dependencies': [
'../shell_dialogs/shell_dialogs.gyp:shell_dialogs',
@@ -603,6 +546,9 @@
'../../ipc/ipc.gyp:test_support_ipc',
'../../skia/skia.gyp:skia',
'../../testing/gtest.gyp:gtest',
+ '../aura/aura.gyp:aura',
+ '../aura/aura.gyp:aura_test_support',
+ '../compositor/compositor.gyp:compositor',
'../events/events.gyp:events',
'../gfx/gfx.gyp:gfx',
'../gfx/gfx.gyp:gfx_geometry',
@@ -644,19 +590,6 @@
'test/ui_controls_factory_desktop_aurax11.h',
],
}],
- ['use_aura==1', {
- 'dependencies': [
- '../aura/aura.gyp:aura_test_support',
- '../compositor/compositor.gyp:compositor',
- ],
- }, { # use_aura==0
- 'sources!': [
- 'corewm/tooltip_controller_test_helper.cc',
- 'corewm/tooltip_controller_test_helper.h',
- 'test/child_modal_window.cc',
- 'test/child_modal_window.h',
- ],
- }],
],
}, # target_name: views_test_support
{
@@ -669,6 +602,7 @@
'../../ipc/ipc.gyp:test_support_ipc',
'../../skia/skia.gyp:skia',
'../../testing/gtest.gyp:gtest',
+ '../aura/aura.gyp:aura',
'../events/events.gyp:events',
'../gfx/gfx.gyp:gfx',
'../gfx/gfx.gyp:gfx_geometry',
@@ -698,6 +632,8 @@
'../../third_party/icu/icu.gyp:icuuc',
'../../url/url.gyp:url_lib',
'../accessibility/accessibility.gyp:accessibility',
+ '../aura/aura.gyp:aura',
+ '../aura/aura.gyp:aura_test_support',
'../base/strings/ui_strings.gyp:ui_strings',
'../compositor/compositor.gyp:compositor',
'../compositor/compositor.gyp:compositor_test_support',
@@ -752,7 +688,6 @@
'focus/focus_manager_test.h',
'focus/focus_manager_test.cc',
'focus/focus_manager_unittest.cc',
- 'focus/focus_manager_unittest_win.cc',
'focus/focus_traversal_unittest.cc',
'ime/input_method_bridge_unittest.cc',
'layout/box_layout_unittest.cc',
@@ -828,22 +763,6 @@
'../../base/allocator/allocator.gyp:allocator',
],
}],
- [ 'use_aura==1', {
- 'dependencies': [
- '../aura/aura.gyp:aura_test_support',
- ],
- }, { # use_aura==0
- 'sources!': [
- 'controls/native/native_view_host_aura_unittest.cc',
- 'widget/native_widget_aura_unittest.cc',
- ],
- 'sources/': [
- ['exclude', 'corewm'],
- ['exclude', 'ime/input_method_bridge_unittest.cc'],
- ['exclude', 'widget/desktop_aura'],
- ['exclude', 'widget/window_reorderer_unittest.cc']
- ],
- }],
['use_ozone==1', {
'sources!': [
'corewm/capture_controller_unittest.cc',
@@ -859,6 +778,7 @@
'../../skia/skia.gyp:skia',
'../../third_party/icu/icu.gyp:icui18n',
'../../third_party/icu/icu.gyp:icuuc',
+ '../aura/aura.gyp:aura',
'../events/events.gyp:events',
'../gfx/gfx.gyp:gfx',
'../gfx/gfx.gyp:gfx_geometry',
@@ -942,6 +862,7 @@
'dependencies': [
'../../base/base.gyp:base',
'../../base/base.gyp:base_i18n',
+ '../aura/aura.gyp:aura',
'../compositor/compositor.gyp:compositor',
'../compositor/compositor.gyp:compositor_test_support',
'../gfx/gfx.gyp:gfx',
@@ -966,6 +887,7 @@
'../../third_party/icu/icu.gyp:icui18n',
'../../third_party/icu/icu.gyp:icuuc',
'../../url/url.gyp:url_lib',
+ '../aura/aura.gyp:aura',
'../events/events.gyp:events',
'../gfx/gfx.gyp:gfx',
'../gfx/gfx.gyp:gfx_geometry',
@@ -1011,6 +933,8 @@
'../../skia/skia.gyp:skia',
'../../third_party/icu/icu.gyp:icui18n',
'../../third_party/icu/icu.gyp:icuuc',
+ '../aura/aura.gyp:aura',
+ '../compositor/compositor.gyp:compositor',
'../events/events.gyp:events',
'../gfx/gfx.gyp:gfx',
'../gfx/gfx.gyp:gfx_geometry',
@@ -1057,11 +981,6 @@
'../../sandbox/sandbox.gyp:sandbox',
],
}],
- ['use_aura==1', {
- 'dependencies': [
- '../compositor/compositor.gyp:compositor',
- ],
- }],
['OS=="win"', {
'sources/': [
# This is needed because the aura rule strips it from the default
diff --git a/ui/views/win/hwnd_util_win.cc b/ui/views/win/hwnd_util_win.cc
deleted file mode 100644
index abc05f8..0000000
--- a/ui/views/win/hwnd_util_win.cc
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2013 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 "ui/views/win/hwnd_util.h"
-
-#include "ui/views/widget/widget.h"
-
-namespace views {
-
-HWND HWNDForView(const View* view) {
- return view->GetWidget() ? HWNDForWidget(view->GetWidget()) : NULL;
-}
-
-// Returns the HWND associated with the specified widget.
-HWND HWNDForWidget(const Widget* widget) {
- return widget->GetNativeView();
-}
-
-HWND HWNDForNativeView(const gfx::NativeView view) {
- return view;
-}
-
-HWND HWNDForNativeWindow(const gfx::NativeWindow window) {
- return window;
-}
-
-gfx::Rect GetWindowBoundsForClientBounds(View* view,
- const gfx::Rect& client_bounds) {
- DCHECK(view);
- HWND hwnd = view->GetWidget()->GetNativeWindow();
- RECT rect = client_bounds.ToRECT();
- DWORD style = ::GetWindowLong(hwnd, GWL_STYLE);
- DWORD ex_style = ::GetWindowLong(hwnd, GWL_EXSTYLE);
- AdjustWindowRectEx(&rect, style, FALSE, ex_style);
- return gfx::Rect(rect);
-}
-
-} // namespace views