From 65f73a3a996bdbaa167e38704df092aa39b53d3a Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Wed, 13 May 2009 17:31:10 +0000 Subject: Remove even more ATL dependencies. Review URL: http://codereview.chromium.org/115309 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15965 0039d316-1c4b-4281-b951-d872f2087c98 --- app/os_exchange_data.cc | 2 -- app/os_exchange_data.h | 5 ++-- app/os_exchange_data_unittest.cc | 28 ++++++++++------------ chrome/browser/browser_main.cc | 5 ++++ chrome/browser/first_run.cc | 4 ++-- chrome/browser/history/history_publisher.cc | 2 +- chrome/browser/history/history_publisher.h | 10 ++++---- chrome/browser/history/history_publisher_win.cc | 5 ++-- chrome/browser/input_window_dialog_win.cc | 3 ++- .../browser/tab_contents/tab_contents_view_win.h | 2 +- .../autocomplete_popup_contents_view.cc | 2 ++ chrome/browser/views/bookmark_bar_view.cc | 2 +- chrome/browser/views/bookmark_bar_view.h | 2 +- chrome/browser/views/bookmark_folder_tree_view.cc | 2 ++ chrome/browser/views/bookmark_manager_view.cc | 10 ++++---- chrome/browser/views/bookmark_manager_view.h | 2 +- chrome/browser/views/bookmark_menu_button.cc | 6 ++--- chrome/browser/views/bookmark_menu_button.h | 4 ++-- chrome/browser/views/bookmark_table_view.cc | 9 ++++--- chrome/browser/views/download_item_view.cc | 2 +- chrome/browser/views/frame/browser_frame.h | 1 + chrome/browser/views/hung_renderer_view.cc | 12 +++++----- chrome/browser/views/infobars/infobars.cc | 5 ++-- chrome/browser/views/login_view.cc | 7 +++--- chrome/browser/views/options/content_page_view.cc | 7 +++--- chrome/browser/views/options/cookies_view.cc | 6 ++--- .../browser/views/options/exceptions_page_view.cc | 10 ++++---- chrome/browser/views/options/fonts_page_view.cc | 3 ++- chrome/browser/views/options/general_page_view.cc | 3 ++- .../browser/views/options/passwords_page_view.cc | 14 ++++++----- chrome/browser/views/page_info_window.cc | 4 ++++ chrome/browser/views/select_profile_dialog.cc | 2 +- chrome/browser/views/tabs/tab.cc | 6 ++--- chrome/browser/views/tabs/tab.h | 2 +- chrome/browser/views/tabs/tab_renderer.cc | 6 ++--- chrome/browser/views/toolbar_view.cc | 10 ++++---- chrome/browser/views/toolbar_view.h | 6 ++--- chrome/browser/views/user_data_dir_dialog.cc | 3 ++- chrome/test/interactive_ui/view_event_test_base.cc | 2 ++ views/controls/button/button_dropdown.cc | 3 ++- views/controls/button/menu_button.cc | 5 ++-- views/controls/button/native_button_win.cc | 2 ++ views/controls/hwnd_view.cc | 7 +++--- views/controls/menu/view_menu_delegate.h | 8 +++++-- views/controls/message_box_view.cc | 4 ++-- views/controls/native_control.cc | 3 ++- views/controls/native_control.h | 6 ++++- views/controls/scrollbar/bitmap_scroll_bar.cc | 17 +++++++------ views/controls/table/group_table_view.cc | 15 ++++++------ views/controls/table/group_table_view.h | 2 +- views/controls/table/table_view.cc | 27 ++++++++++++--------- views/controls/table/table_view.h | 3 ++- views/controls/text_field.cc | 1 + views/controls/tree/tree_view.cc | 8 ++++--- views/controls/tree/tree_view.h | 5 +++- views/grid_layout_unittest.cc | 22 ++++++++--------- views/view.h | 10 ++++---- views/widget/root_view_drop_target.h | 4 ---- views/widget/tooltip_manager.cc | 1 + views/widget/widget_win.h | 8 ++++--- views/window/custom_frame_view.cc | 11 +++++---- views/window/window_win.h | 2 -- webkit/tools/test_shell/foreground_helper.h | 14 +++++------ 63 files changed, 225 insertions(+), 179 deletions(-) diff --git a/app/os_exchange_data.cc b/app/os_exchange_data.cc index c9e2311..e27c6fd 100644 --- a/app/os_exchange_data.cc +++ b/app/os_exchange_data.cc @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include - #include "app/os_exchange_data.h" #include "app/l10n_util.h" diff --git a/app/os_exchange_data.h b/app/os_exchange_data.h index 5668008..4a8fbc4 100644 --- a/app/os_exchange_data.h +++ b/app/os_exchange_data.h @@ -5,11 +5,10 @@ #ifndef APP_OS_EXCHANGE_DATA_H_ #define APP_OS_EXCHANGE_DATA_H_ -#include #include #include -#include "base/basictypes.h" +#include "base/scoped_comptr_win.h" class GURL; class Pickle; @@ -134,7 +133,7 @@ class OSExchangeData : public IDataObject { typedef std::vector StoredData; StoredData contents_; - CComPtr source_object_; + ScopedComPtr source_object_; LONG ref_count_; diff --git a/app/os_exchange_data_unittest.cc b/app/os_exchange_data_unittest.cc index 13a28a9..981a8d1 100644 --- a/app/os_exchange_data_unittest.cc +++ b/app/os_exchange_data_unittest.cc @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include -#include - #include "app/os_exchange_data.h" #include "base/clipboard_util.h" #include "base/pickle.h" @@ -42,7 +39,7 @@ TEST(OSExchangeDataTest, StringDataAccessViaCOM) { OSExchangeData* data = new OSExchangeData; std::wstring input = L"O hai googlz."; data->SetString(input); - CComPtr com_data(data); + ScopedComPtr com_data(data); FORMATETC format_etc = { CF_UNICODETEXT, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; @@ -54,8 +51,6 @@ TEST(OSExchangeDataTest, StringDataAccessViaCOM) { ScopedHGlobal(medium.hGlobal).get(); EXPECT_EQ(input, output); ReleaseStgMedium(&medium); - - // data is freed automatically by CComPtr. } // Test setting using the IDataObject COM API @@ -63,7 +58,7 @@ TEST(OSExchangeDataTest, StringDataWritingViaCOM) { OSExchangeData* data = new OSExchangeData; std::wstring input = L"http://www.google.com/"; - CComPtr com_data(data); + ScopedComPtr com_data(data); // Store data in the object using the COM SetData API. CLIPFORMAT cfstr_ineturl = RegisterClipboardFormat(CFSTR_INETURL); @@ -98,7 +93,7 @@ TEST(OSExchangeDataTest, URLDataAccessViaCOM) { OSExchangeData* data = new OSExchangeData; GURL url("http://www.google.com/"); data->SetURL(url, L""); - CComPtr com_data(data); + ScopedComPtr com_data(data); CLIPFORMAT cfstr_ineturl = RegisterClipboardFormat(CFSTR_INETURL); FORMATETC format_etc = @@ -121,7 +116,7 @@ TEST(OSExchangeDataTest, MultipleFormatsViaCOM) { data->SetURL(url, L"Google"); data->SetString(text); - CComPtr com_data(data); + ScopedComPtr com_data(data); CLIPFORMAT cfstr_ineturl = RegisterClipboardFormat(CFSTR_INETURL); FORMATETC url_format_etc = @@ -156,9 +151,10 @@ TEST(OSExchangeDataTest, EnumerationViaCOM) { RegisterClipboardFormat(CFSTR_FILEDESCRIPTOR); CLIPFORMAT text_x_moz_url = RegisterClipboardFormat(L"text/x-moz-url"); - CComPtr com_data(data); - CComPtr enumerator; - EXPECT_EQ(S_OK, com_data->EnumFormatEtc(DATADIR_GET, &enumerator)); + ScopedComPtr com_data(data); + ScopedComPtr enumerator; + EXPECT_EQ(S_OK, com_data.get()->EnumFormatEtc(DATADIR_GET, + enumerator.Receive())); // Test that we can get one item. { @@ -210,9 +206,9 @@ TEST(OSExchangeDataTest, EnumerationViaCOM) { { EXPECT_EQ(S_OK, enumerator->Reset()); EXPECT_EQ(S_OK, enumerator->Skip(1)); - CComPtr cloned_enumerator; - EXPECT_EQ(S_OK, enumerator->Clone(&cloned_enumerator)); - EXPECT_EQ(S_OK, enumerator->Reset()); + ScopedComPtr cloned_enumerator; + EXPECT_EQ(S_OK, enumerator.get()->Clone(cloned_enumerator.Receive())); + EXPECT_EQ(S_OK, enumerator.get()->Reset()); { ULONG retrieved = 0; @@ -257,7 +253,7 @@ TEST(OSExchangeDataTest, TestURLExchangeFormats) { EXPECT_EQ(url_spec, WideToUTF8(output_string)); // File contents access via COM - CComPtr com_data(data); + ScopedComPtr com_data(data); { CLIPFORMAT cfstr_file_contents = RegisterClipboardFormat(CFSTR_FILECONTENTS); diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 1bde447..e83f54f 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -4,6 +4,11 @@ #include "build/build_config.h" +#if defined(OS_WIN) +#include +#include +#endif + #include #include "app/l10n_util.h" diff --git a/chrome/browser/first_run.cc b/chrome/browser/first_run.cc index 6304609..d00ee47 100644 --- a/chrome/browser/first_run.cc +++ b/chrome/browser/first_run.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/browser/first_run.h" + #include #include #include @@ -9,8 +11,6 @@ #include -#include "chrome/browser/first_run.h" - #include "app/resource_bundle.h" #include "base/command_line.h" #include "base/file_util.h" diff --git a/chrome/browser/history/history_publisher.cc b/chrome/browser/history/history_publisher.cc index 52327c5..364bb821 100644 --- a/chrome/browser/history/history_publisher.cc +++ b/chrome/browser/history/history_publisher.cc @@ -6,7 +6,7 @@ namespace history { -const char* HistoryPublisher::kThumbnailImageFormat = "image/jpeg"; +const char* const HistoryPublisher::kThumbnailImageFormat = "image/jpeg"; void HistoryPublisher::PublishPageThumbnail( const std::vector& thumbnail, const GURL& url, diff --git a/chrome/browser/history/history_publisher.h b/chrome/browser/history/history_publisher.h index 71005e5..00090659 100644 --- a/chrome/browser/history/history_publisher.h +++ b/chrome/browser/history/history_publisher.h @@ -8,14 +8,12 @@ #include #include -#include "base/basictypes.h" +#include "base/scoped_comptr_win.h" #include "base/time.h" #include "chrome/browser/history/history_types.h" #include "googleurl/src/gurl.h" #if defined(OS_WIN) -#include -#include #include "history_indexer.h" #endif @@ -60,18 +58,18 @@ class HistoryPublisher { // Returns '0' if the time object is NULL. static double TimeToUTCVariantTime(const base::Time& time); - typedef std::vector > IndexerList; + typedef std::vector< ScopedComPtr > IndexerList; // The list of indexers registered to receive history data from us. IndexerList indexers_; // The Registry key under HKCU where the indexers need to register their // CLSID. - static const wchar_t* kRegKeyRegisteredIndexersInfo; + static const wchar_t* const kRegKeyRegisteredIndexersInfo; #endif // The format of the thumbnail we pass to indexers. - static const char* kThumbnailImageFormat; + static const char* const kThumbnailImageFormat; DISALLOW_COPY_AND_ASSIGN(HistoryPublisher); }; diff --git a/chrome/browser/history/history_publisher_win.cc b/chrome/browser/history/history_publisher_win.cc index 72c0f1d..ef4fb7f 100644 --- a/chrome/browser/history/history_publisher_win.cc +++ b/chrome/browser/history/history_publisher_win.cc @@ -10,10 +10,11 @@ #include #include "base/registry.h" +#include "base/scoped_comptr_win.h" namespace history { -const wchar_t* HistoryPublisher::kRegKeyRegisteredIndexersInfo = +const wchar_t* const HistoryPublisher::kRegKeyRegisteredIndexersInfo = L"Software\\Google\\Google Chrome\\IndexerPlugins"; // static @@ -60,7 +61,7 @@ bool HistoryPublisher::ReadRegisteredIndexersFromRegistry() { CLSID clsid; CLSIDFromString(static_cast( const_cast(iter.Name())), &clsid); - CComPtr indexer; + ScopedComPtr indexer; HRESULT hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC, __uuidof(IChromeHistoryIndexer), reinterpret_cast(&indexer)); diff --git a/chrome/browser/input_window_dialog_win.cc b/chrome/browser/input_window_dialog_win.cc index d236cc9..2da360a 100644 --- a/chrome/browser/input_window_dialog_win.cc +++ b/chrome/browser/input_window_dialog_win.cc @@ -5,6 +5,7 @@ #include "chrome/browser/input_window_dialog.h" #include "app/l10n_util.h" +#include "base/compiler_specific.h" #include "base/message_loop.h" #include "base/task.h" #include "views/grid_layout.h" @@ -60,7 +61,7 @@ class ContentView : public views::View, public: explicit ContentView(WinInputWindowDialog* delegate) : delegate_(delegate), - focus_grabber_factory_(this) { + ALLOW_THIS_IN_INITIALIZER_LIST(focus_grabber_factory_(this)) { DCHECK(delegate_); } diff --git a/chrome/browser/tab_contents/tab_contents_view_win.h b/chrome/browser/tab_contents/tab_contents_view_win.h index 6e36549..4166891 100644 --- a/chrome/browser/tab_contents/tab_contents_view_win.h +++ b/chrome/browser/tab_contents/tab_contents_view_win.h @@ -64,7 +64,7 @@ class TabContentsViewWin : public TabContentsView, virtual void OnSetFocus(HWND window); virtual void OnVScroll(int scroll_type, short position, HWND scrollbar); virtual void OnWindowPosChanged(WINDOWPOS* window_pos); - virtual void OnSize(UINT param, const CSize& size); + virtual void OnSize(UINT param, const WTL::CSize& size); virtual LRESULT OnNCCalcSize(BOOL w_param, LPARAM l_param); virtual void OnNCPaint(HRGN rgn); diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc index d62465f..f4d9e9e 100644 --- a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc +++ b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc @@ -4,6 +4,8 @@ #include "chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h" +#include +#include #include #include "app/gfx/chrome_canvas.h" diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc index 88264f2..71b4051 100644 --- a/chrome/browser/views/bookmark_bar_view.cc +++ b/chrome/browser/views/bookmark_bar_view.cc @@ -1093,7 +1093,7 @@ int BookmarkBarView::GetDragOperations(View* sender, int x, int y) { } void BookmarkBarView::RunMenu(views::View* view, - const CPoint& pt, + const gfx::Point& pt, HWND hwnd) { BookmarkNode* node; MenuItemView::AnchorPosition anchor_point = MenuItemView::TOPLEFT; diff --git a/chrome/browser/views/bookmark_bar_view.h b/chrome/browser/views/bookmark_bar_view.h index a56f51a..ccf787e 100644 --- a/chrome/browser/views/bookmark_bar_view.h +++ b/chrome/browser/views/bookmark_bar_view.h @@ -300,7 +300,7 @@ class BookmarkBarView : public views::View, // . menu for star groups. // The latter two are handled by a MenuRunner, which builds the appropriate // menu. - virtual void RunMenu(views::View* view, const CPoint& pt, HWND hwnd); + virtual void RunMenu(views::View* view, const gfx::Point& pt, HWND hwnd); // Invoked when a star entry corresponding to a URL on the bookmark bar is // pressed. Forwards to the PageNavigator to open the URL. diff --git a/chrome/browser/views/bookmark_folder_tree_view.cc b/chrome/browser/views/bookmark_folder_tree_view.cc index e092670..801973f 100644 --- a/chrome/browser/views/bookmark_folder_tree_view.cc +++ b/chrome/browser/views/bookmark_folder_tree_view.cc @@ -4,6 +4,8 @@ #include "chrome/browser/views/bookmark_folder_tree_view.h" +#include + #include "app/drag_drop_types.h" #include "app/os_exchange_data.h" #include "base/base_drag_source.h" diff --git a/chrome/browser/views/bookmark_manager_view.cc b/chrome/browser/views/bookmark_manager_view.cc index d635932..6831f11 100644 --- a/chrome/browser/views/bookmark_manager_view.cc +++ b/chrome/browser/views/bookmark_manager_view.cc @@ -137,7 +137,7 @@ BookmarkManagerView::BookmarkManagerView(Profile* profile) : profile_(profile->GetOriginalProfile()), table_view_(NULL), tree_view_(NULL), - search_factory_(this) { + ALLOW_THIS_IN_INITIALIZER_LIST(search_factory_(this)) { search_tf_ = new views::TextField(); search_tf_->set_default_width_in_chars(30); @@ -479,7 +479,7 @@ void BookmarkManagerView::ShowContextMenu(views::View* source, } void BookmarkManagerView::RunMenu(views::View* source, - const CPoint& pt, + const gfx::Point& pt, HWND hwnd) { // TODO(glen): when you change the buttons around and what not, futz with // this to make it look good. If you end up keeping padding numbers make them @@ -487,14 +487,14 @@ void BookmarkManagerView::RunMenu(views::View* source, if (!GetBookmarkModel()->IsLoaded()) return; - int menu_x = pt.x; + int menu_x = pt.x(); menu_x += UILayoutIsRightToLeft() ? (source->width() - 5) : (-source->width() + 5); if (source->GetID() == kOrganizeMenuButtonID) { - ShowMenu(hwnd, menu_x, pt.y + 2, + ShowMenu(hwnd, menu_x, pt.y() + 2, BookmarkContextMenu::BOOKMARK_MANAGER_ORGANIZE_MENU); } else if (source->GetID() == kToolsMenuButtonID) { - ShowToolsMenu(hwnd, menu_x, pt.y + 2); + ShowToolsMenu(hwnd, menu_x, pt.y() + 2); } else { NOTREACHED(); } diff --git a/chrome/browser/views/bookmark_manager_view.h b/chrome/browser/views/bookmark_manager_view.h index a624281..33566a4 100644 --- a/chrome/browser/views/bookmark_manager_view.h +++ b/chrome/browser/views/bookmark_manager_view.h @@ -147,7 +147,7 @@ class BookmarkManagerView : public views::View, bool is_mouse_gesture); // ViewMenuDelegate. - virtual void RunMenu(views::View* source, const CPoint& pt, HWND hwnd); + virtual void RunMenu(views::View* source, const gfx::Point& pt, HWND hwnd); // MenuDelegate. virtual void ExecuteCommand(int id); diff --git a/chrome/browser/views/bookmark_menu_button.cc b/chrome/browser/views/bookmark_menu_button.cc index 0074e61..3f6c43a 100644 --- a/chrome/browser/views/bookmark_menu_button.cc +++ b/chrome/browser/views/bookmark_menu_button.cc @@ -93,13 +93,13 @@ void BookmarkMenuButton::BookmarkMenuDeleted( } void BookmarkMenuButton::RunMenu(views::View* source, - const CPoint& pt, + const gfx::Point& pt, gfx::NativeView hwnd) { RunMenu(source, pt, hwnd, false); } void BookmarkMenuButton::RunMenu(views::View* source, - const CPoint& pt, + const gfx::Point& pt, gfx::NativeView hwnd, bool for_drop) { Profile* profile = browser_->profile(); @@ -141,5 +141,5 @@ void BookmarkMenuButton::StopShowFolderDropMenuTimer() { } void BookmarkMenuButton::ShowDropMenu() { - RunMenu(NULL, CPoint(), GetWidget()->GetNativeView(), true); + RunMenu(NULL, gfx::Point(), GetWidget()->GetNativeView(), true); } diff --git a/chrome/browser/views/bookmark_menu_button.h b/chrome/browser/views/bookmark_menu_button.h index 0ebb59f..3f2a98e 100644 --- a/chrome/browser/views/bookmark_menu_button.h +++ b/chrome/browser/views/bookmark_menu_button.h @@ -36,13 +36,13 @@ class BookmarkMenuButton : public views::MenuButton, // ViewMenuDelegate. virtual void RunMenu(views::View* source, - const CPoint& pt, + const gfx::Point& pt, gfx::NativeView hwnd); private: // Shows the menu. void RunMenu(views::View* source, - const CPoint& pt, + const gfx::Point& pt, gfx::NativeView hwnd, bool for_drop); diff --git a/chrome/browser/views/bookmark_table_view.cc b/chrome/browser/views/bookmark_table_view.cc index c1b4023..edbedf0 100644 --- a/chrome/browser/views/bookmark_table_view.cc +++ b/chrome/browser/views/bookmark_table_view.cc @@ -4,6 +4,8 @@ #include "chrome/browser/views/bookmark_table_view.h" +#include + #include "app/drag_drop_types.h" #include "app/gfx/chrome_canvas.h" #include "app/gfx/chrome_font.h" @@ -430,11 +432,12 @@ void BookmarkTableView::PaintAltText() { gfx::Rect BookmarkTableView::GetAltTextBounds() { static const int kXOffset = 16; DCHECK(GetNativeControlHWND()); - CRect client_rect; - GetClientRect(GetNativeControlHWND(), client_rect); + RECT client_rect_rect; + GetClientRect(GetNativeControlHWND(), &client_rect_rect); + gfx::Rect client_rect(client_rect_rect); ChromeFont font = GetAltTextFont(); // Pad height by 2 for halo. - return gfx::Rect(kXOffset, content_offset(), client_rect.Width() - kXOffset, + return gfx::Rect(kXOffset, content_offset(), client_rect.width() - kXOffset, std::max(kImageSize, font.height() + 2)); } diff --git a/chrome/browser/views/download_item_view.cc b/chrome/browser/views/download_item_view.cc index 915e78f..7aa2a37 100644 --- a/chrome/browser/views/download_item_view.cc +++ b/chrome/browser/views/download_item_view.cc @@ -143,7 +143,7 @@ DownloadItemView::DownloadItemView(DownloadItem* download, dangerous_download_label_(NULL), dangerous_download_label_sized_(false), creation_time_(base::Time::Now()), - reenable_method_factory_(this), + ALLOW_THIS_IN_INITIALIZER_LIST(reenable_method_factory_(this)), disabled_while_opening_(false) { // TODO(idana) Bug# 1163334 // diff --git a/chrome/browser/views/frame/browser_frame.h b/chrome/browser/views/frame/browser_frame.h index 792e90e..fdb5e49 100644 --- a/chrome/browser/views/frame/browser_frame.h +++ b/chrome/browser/views/frame/browser_frame.h @@ -6,6 +6,7 @@ #define CHROME_BROWSER_VIEWS_FRAME_BROWSER_FRAME_ #include "views/window/window_win.h" +#include "views/window/non_client_view.h" class AeroGlassNonClientView; class BrowserView; diff --git a/chrome/browser/views/hung_renderer_view.cc b/chrome/browser/views/hung_renderer_view.cc index 20c7e06..4c1397a 100644 --- a/chrome/browser/views/hung_renderer_view.cc +++ b/chrome/browser/views/hung_renderer_view.cc @@ -405,14 +405,14 @@ void HungRendererDialogView::CreateKillButtonView() { gfx::Rect HungRendererDialogView::GetDisplayBounds( TabContents* contents) { HWND contents_hwnd = contents->GetNativeView(); - CRect contents_bounds; - GetWindowRect(contents_hwnd, &contents_bounds); - + RECT contents_bounds_rect; + GetWindowRect(contents_hwnd, &contents_bounds_rect); + gfx::Rect contents_bounds(contents_bounds_rect); gfx::Rect window_bounds = window()->GetBounds(); - int window_x = contents_bounds.left + - (contents_bounds.Width() - window_bounds.width()) / 2; - int window_y = contents_bounds.top + kOverlayContentsOffsetY; + int window_x = contents_bounds.x() + + (contents_bounds.width() - window_bounds.width()) / 2; + int window_y = contents_bounds.y() + kOverlayContentsOffsetY; return gfx::Rect(window_x, window_y, window_bounds.width(), window_bounds.height()); } diff --git a/chrome/browser/views/infobars/infobars.cc b/chrome/browser/views/infobars/infobars.cc index 6749dec..f14aded 100644 --- a/chrome/browser/views/infobars/infobars.cc +++ b/chrome/browser/views/infobars/infobars.cc @@ -84,8 +84,9 @@ class InfoBarBackground : public views::Background { InfoBar::InfoBar(InfoBarDelegate* delegate) : delegate_(delegate), - close_button_(new views::ImageButton(this)), - delete_factory_(this) { + ALLOW_THIS_IN_INITIALIZER_LIST( + close_button_(new views::ImageButton(this))), + ALLOW_THIS_IN_INITIALIZER_LIST(delete_factory_(this)) { // We delete ourselves when we're removed from the view hierarchy. SetParentOwned(false); diff --git a/chrome/browser/views/login_view.cc b/chrome/browser/views/login_view.cc index cab7ba2..df7f1b4 100644 --- a/chrome/browser/views/login_view.cc +++ b/chrome/browser/views/login_view.cc @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include - #include "chrome/browser/views/login_view.h" +#include + #include "app/l10n_util.h" +#include "base/compiler_specific.h" #include "base/message_loop.h" #include "grit/generated_resources.h" #include "views/grid_layout.h" @@ -31,7 +32,7 @@ LoginView::LoginView(const std::wstring& explanation) password_label_(new Label( l10n_util::GetString(IDS_LOGIN_DIALOG_PASSWORD_FIELD))), message_label_(new Label(explanation)), - focus_grabber_factory_(this), + ALLOW_THIS_IN_INITIALIZER_LIST(focus_grabber_factory_(this)), login_model_(NULL) { message_label_->SetMultiLine(true); message_label_->SetHorizontalAlignment(Label::ALIGN_LEFT); diff --git a/chrome/browser/views/options/content_page_view.cc b/chrome/browser/views/options/content_page_view.cc index abd1d9b..ef822ee12 100644 --- a/chrome/browser/views/options/content_page_view.cc +++ b/chrome/browser/views/options/content_page_view.cc @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/browser/views/options/content_page_view.h" + #include #include #include #include -#include "chrome/browser/views/options/content_page_view.h" - #include "app/gfx/chrome_canvas.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" @@ -176,7 +176,8 @@ ContentPageView::ContentPageView(Profile* profile) download_default_download_location_display_(NULL), download_browse_button_(NULL), download_ask_for_save_location_checkbox_(NULL), - select_file_dialog_(SelectFileDialog::Create(this)), + ALLOW_THIS_IN_INITIALIZER_LIST( + select_file_dialog_(SelectFileDialog::Create(this))), passwords_exceptions_button_(NULL), passwords_group_(NULL), passwords_asktosave_radio_(NULL), diff --git a/chrome/browser/views/options/cookies_view.cc b/chrome/browser/views/options/cookies_view.cc index cc8d65c..a294fff 100644 --- a/chrome/browser/views/options/cookies_view.cc +++ b/chrome/browser/views/options/cookies_view.cc @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include - #include "chrome/browser/views/options/cookies_view.h" +#include + #include "app/gfx/chrome_canvas.h" #include "app/gfx/color_utils.h" #include "app/l10n_util.h" @@ -697,7 +697,7 @@ CookiesView::CookiesView(Profile* profile) remove_button_(NULL), remove_all_button_(NULL), profile_(profile), - search_update_factory_(this) { + ALLOW_THIS_IN_INITIALIZER_LIST(search_update_factory_(this)) { } void CookiesView::Init() { diff --git a/chrome/browser/views/options/exceptions_page_view.cc b/chrome/browser/views/options/exceptions_page_view.cc index daff30e..ecc9884 100644 --- a/chrome/browser/views/options/exceptions_page_view.cc +++ b/chrome/browser/views/options/exceptions_page_view.cc @@ -77,10 +77,12 @@ void ExceptionsTableModel::OnWebDataServiceRequestDone( // ExceptionsPageView, public ExceptionsPageView::ExceptionsPageView(Profile* profile) : OptionsPageView(profile), - remove_button_(this, l10n_util::GetString( - IDS_EXCEPTIONS_PAGE_VIEW_REMOVE_BUTTON)), - remove_all_button_(this, l10n_util::GetString( - IDS_EXCEPTIONS_PAGE_VIEW_REMOVE_ALL_BUTTON)), + ALLOW_THIS_IN_INITIALIZER_LIST(remove_button_( + this, + l10n_util::GetString(IDS_EXCEPTIONS_PAGE_VIEW_REMOVE_BUTTON))), + ALLOW_THIS_IN_INITIALIZER_LIST(remove_all_button_( + this, + l10n_util::GetString(IDS_EXCEPTIONS_PAGE_VIEW_REMOVE_ALL_BUTTON))), table_model_(profile), table_view_(NULL) { } diff --git a/chrome/browser/views/options/fonts_page_view.cc b/chrome/browser/views/options/fonts_page_view.cc index 09db2ff..27d710a 100644 --- a/chrome/browser/views/options/fonts_page_view.cc +++ b/chrome/browser/views/options/fonts_page_view.cc @@ -209,7 +209,8 @@ void EmbellishTitle(views::Label* title_label) { } FontsPageView::FontsPageView(Profile* profile) - : select_font_dialog_(SelectFontDialog::Create(this)), + : ALLOW_THIS_IN_INITIALIZER_LIST( + select_font_dialog_(SelectFontDialog::Create(this))), fonts_group_title_(NULL), encoding_group_title_(NULL), fixed_width_font_change_page_button_(NULL), diff --git a/chrome/browser/views/options/general_page_view.cc b/chrome/browser/views/options/general_page_view.cc index eb4675c..7c54d5c 100644 --- a/chrome/browser/views/options/general_page_view.cc +++ b/chrome/browser/views/options/general_page_view.cc @@ -521,7 +521,8 @@ GeneralPageView::GeneralPageView(Profile* profile) default_browser_group_(NULL), default_browser_status_label_(NULL), default_browser_use_as_default_button_(NULL), - default_browser_worker_(new DefaultBrowserWorker(this)), + ALLOW_THIS_IN_INITIALIZER_LIST( + default_browser_worker_(new DefaultBrowserWorker(this))), OptionsPageView(profile) { } diff --git a/chrome/browser/views/options/passwords_page_view.cc b/chrome/browser/views/options/passwords_page_view.cc index 77c02ad..29ed27a 100644 --- a/chrome/browser/views/options/passwords_page_view.cc +++ b/chrome/browser/views/options/passwords_page_view.cc @@ -183,14 +183,16 @@ void PasswordsTableModel::CancelLoginsQuery() { // PasswordsPageView, public PasswordsPageView::PasswordsPageView(Profile* profile) : OptionsPageView(profile), - show_button_( + ALLOW_THIS_IN_INITIALIZER_LIST(show_button_( this, l10n_util::GetString(IDS_PASSWORDS_PAGE_VIEW_SHOW_BUTTON), - l10n_util::GetString(IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON)), - remove_button_(this, l10n_util::GetString( - IDS_PASSWORDS_PAGE_VIEW_REMOVE_BUTTON)), - remove_all_button_(this, l10n_util::GetString( - IDS_PASSWORDS_PAGE_VIEW_REMOVE_ALL_BUTTON)), + l10n_util::GetString(IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON))), + ALLOW_THIS_IN_INITIALIZER_LIST(remove_button_( + this, + l10n_util::GetString(IDS_PASSWORDS_PAGE_VIEW_REMOVE_BUTTON))), + ALLOW_THIS_IN_INITIALIZER_LIST(remove_all_button_( + this, + l10n_util::GetString(IDS_PASSWORDS_PAGE_VIEW_REMOVE_ALL_BUTTON))), table_model_(profile), table_view_(NULL) { } diff --git a/chrome/browser/views/page_info_window.cc b/chrome/browser/views/page_info_window.cc index 3c045b7..8c9e6ad 100644 --- a/chrome/browser/views/page_info_window.cc +++ b/chrome/browser/views/page_info_window.cc @@ -7,6 +7,10 @@ #include #pragma comment(lib, "cryptui.lib") +#include +#include +#include + #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "app/win_util.h" diff --git a/chrome/browser/views/select_profile_dialog.cc b/chrome/browser/views/select_profile_dialog.cc index ff9c0a3..faa4a04 100644 --- a/chrome/browser/views/select_profile_dialog.cc +++ b/chrome/browser/views/select_profile_dialog.cc @@ -33,7 +33,7 @@ void SelectProfileDialog::RunDialog() { } SelectProfileDialog::SelectProfileDialog() - : helper_(new GetProfilesHelper(this)) { + : ALLOW_THIS_IN_INITIALIZER_LIST(helper_(new GetProfilesHelper(this))) { // We first create an instance of the helper and then setup controls. This // doesn't lead to race condition because once the helper is done with // enumerating profiles by examining the file system, it posts a task on the diff --git a/chrome/browser/views/tabs/tab.cc b/chrome/browser/views/tabs/tab.cc index 3975604..cb7504c 100644 --- a/chrome/browser/views/tabs/tab.cc +++ b/chrome/browser/views/tabs/tab.cc @@ -208,10 +208,10 @@ bool Tab::GetTooltipText(int x, int y, std::wstring* tooltip) { return false; } -bool Tab::GetTooltipTextOrigin(int x, int y, CPoint* origin) { +bool Tab::GetTooltipTextOrigin(int x, int y, gfx::Point* origin) { ChromeFont font; - origin->x = title_bounds().x() + 10; - origin->y = -views::TooltipManager::GetTooltipHeight() - 4; + origin->set_x(title_bounds().x() + 10); + origin->set_y(-views::TooltipManager::GetTooltipHeight() - 4); return true; } diff --git a/chrome/browser/views/tabs/tab.h b/chrome/browser/views/tabs/tab.h index ec295ed..920a849 100644 --- a/chrome/browser/views/tabs/tab.h +++ b/chrome/browser/views/tabs/tab.h @@ -101,7 +101,7 @@ class Tab : public TabRenderer, virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled); virtual bool GetTooltipText(int x, int y, std::wstring* tooltip); - virtual bool GetTooltipTextOrigin(int x, int y, CPoint* origin); + virtual bool GetTooltipTextOrigin(int x, int y, gfx::Point* origin); virtual std::string GetClassName() const { return kTabClassName; } virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); virtual bool GetAccessibleName(std::wstring* name); diff --git a/chrome/browser/views/tabs/tab_renderer.cc b/chrome/browser/views/tabs/tab_renderer.cc index e7b664b..96bdd918 100644 --- a/chrome/browser/views/tabs/tab_renderer.cc +++ b/chrome/browser/views/tabs/tab_renderer.cc @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include - #include "chrome/browser/views/tabs/tab_renderer.h" +#include + #include "app/gfx/chrome_canvas.h" #include "app/gfx/chrome_font.h" #include "app/l10n_util.h" @@ -174,7 +174,7 @@ class TabRenderer::FavIconCrashAnimation : public Animation, public AnimationDelegate { public: explicit FavIconCrashAnimation(TabRenderer* target) - : Animation(1000, 25, this), + : ALLOW_THIS_IN_INITIALIZER_LIST(Animation(1000, 25, this)), target_(target) { } virtual ~FavIconCrashAnimation() {} diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index 333dcf4..104cb34 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -582,7 +582,7 @@ gfx::Size BrowserToolbarView::GetPreferredSize() { vertical_spacing); } -void BrowserToolbarView::RunPageMenu(const CPoint& pt, HWND hwnd) { +void BrowserToolbarView::RunPageMenu(const gfx::Point& pt, HWND hwnd) { Menu::AnchorPoint anchor = Menu::TOPRIGHT; if (UILayoutIsRightToLeft()) anchor = Menu::TOPLEFT; @@ -646,10 +646,10 @@ void BrowserToolbarView::RunPageMenu(const CPoint& pt, HWND hwnd) { menu.AppendMenuItemWithLabel(IDC_REPORT_BUG, l10n_util::GetString(IDS_REPORT_BUG)); - menu.RunMenuAt(pt.x, pt.y); + menu.RunMenuAt(pt.x(), pt.y()); } -void BrowserToolbarView::RunAppMenu(const CPoint& pt, HWND hwnd) { +void BrowserToolbarView::RunAppMenu(const gfx::Point& pt, HWND hwnd) { Menu::AnchorPoint anchor = Menu::TOPRIGHT; if (UILayoutIsRightToLeft()) anchor = Menu::TOPLEFT; @@ -704,7 +704,7 @@ void BrowserToolbarView::RunAppMenu(const CPoint& pt, HWND hwnd) { menu.AppendSeparator(); menu.AppendMenuItemWithLabel(IDC_EXIT, l10n_util::GetString(IDS_EXIT)); - menu.RunMenuAt(pt.x, pt.y); + menu.RunMenuAt(pt.x(), pt.y()); // Menu is going away, so set the profiles menu pointer to NULL. profiles_menu_ = NULL; @@ -718,7 +718,7 @@ bool BrowserToolbarView::IsItemChecked(int id) const { return EncodingMenuControllerDelegate::IsItemChecked(id); } -void BrowserToolbarView::RunMenu(views::View* source, const CPoint& pt, +void BrowserToolbarView::RunMenu(views::View* source, const gfx::Point& pt, HWND hwnd) { switch (source->GetID()) { case VIEW_ID_PAGE_MENU: diff --git a/chrome/browser/views/toolbar_view.h b/chrome/browser/views/toolbar_view.h index b5f3861..ad373d4 100644 --- a/chrome/browser/views/toolbar_view.h +++ b/chrome/browser/views/toolbar_view.h @@ -72,7 +72,7 @@ class BrowserToolbarView : public views::View, virtual bool GetAcceleratorInfo(int id, views::Accelerator* accel); // views::MenuDelegate - virtual void RunMenu(views::View* source, const CPoint& pt, HWND hwnd); + virtual void RunMenu(views::View* source, const gfx::Point& pt, HWND hwnd); // GetProfilesHelper::Delegate method. virtual void OnGetProfilesDone(const std::vector& profiles); @@ -157,10 +157,10 @@ class BrowserToolbarView : public views::View, void SetSecurityLevel(ToolbarModel::SecurityLevel security_level); // Show the page menu. - void RunPageMenu(const CPoint& pt, HWND hwnd); + void RunPageMenu(const gfx::Point& pt, HWND hwnd); // Show the app menu. - void RunAppMenu(const CPoint& pt, HWND hwnd); + void RunAppMenu(const gfx::Point& pt, HWND hwnd); // Overridden from View, to pass keyboard triggering of the right-click // context menu on to the toolbar child view that currently has the diff --git a/chrome/browser/views/user_data_dir_dialog.cc b/chrome/browser/views/user_data_dir_dialog.cc index c6b17f3..70f9924 100644 --- a/chrome/browser/views/user_data_dir_dialog.cc +++ b/chrome/browser/views/user_data_dir_dialog.cc @@ -22,7 +22,8 @@ std::wstring UserDataDirDialog::RunUserDataDirDialog( } UserDataDirDialog::UserDataDirDialog(const std::wstring& user_data_dir) - : select_file_dialog_(SelectFileDialog::Create(this)), + : ALLOW_THIS_IN_INITIALIZER_LIST( + select_file_dialog_(SelectFileDialog::Create(this))), is_blocking_(true) { std::wstring message_text = l10n_util::GetStringF( IDS_CANT_WRITE_USER_DIRECTORY_SUMMARY, user_data_dir); diff --git a/chrome/test/interactive_ui/view_event_test_base.cc b/chrome/test/interactive_ui/view_event_test_base.cc index 19de3e8..a1203d5 100644 --- a/chrome/test/interactive_ui/view_event_test_base.cc +++ b/chrome/test/interactive_ui/view_event_test_base.cc @@ -4,6 +4,8 @@ #include "chrome/test/interactive_ui/view_event_test_base.h" +#include + #include "base/message_loop.h" #include "chrome/browser/automation/ui_controls.h" #include "views/view.h" diff --git a/views/controls/button/button_dropdown.cc b/views/controls/button/button_dropdown.cc index 270894b..157caf0 100644 --- a/views/controls/button/button_dropdown.cc +++ b/views/controls/button/button_dropdown.cc @@ -5,6 +5,7 @@ #include "views/controls/button/button_dropdown.h" #include "app/l10n_util.h" +#include "base/compiler_specific.h" #include "base/message_loop.h" #include "grit/generated_resources.h" #include "views/controls/menu/view_menu_delegate.h" @@ -26,7 +27,7 @@ ButtonDropDown::ButtonDropDown(ButtonListener* listener, : ImageButton(listener), menu_delegate_(menu_delegate), y_position_on_lbuttondown_(0), - show_menu_factory_(this) { + ALLOW_THIS_IN_INITIALIZER_LIST(show_menu_factory_(this)) { } ButtonDropDown::~ButtonDropDown() { diff --git a/views/controls/button/menu_button.cc b/views/controls/button/menu_button.cc index 993cd9b..6dbf4ae 100644 --- a/views/controls/button/menu_button.cc +++ b/views/controls/button/menu_button.cc @@ -110,7 +110,7 @@ int MenuButton::GetMaximumScreenXCoordinate() { } HWND hwnd = widget->GetNativeView(); - CRect t; + RECT t; ::GetWindowRect(hwnd, &t); gfx::Rect r(t); @@ -154,8 +154,7 @@ bool MenuButton::Activate() { GetRootView()->SetMouseHandler(NULL); menu_visible_ = true; - menu_delegate_->RunMenu(this, menu_position.ToPOINT(), - GetWidget()->GetNativeView()); + menu_delegate_->RunMenu(this, menu_position, GetWidget()->GetNativeView()); menu_visible_ = false; menu_closed_time_ = Time::Now(); diff --git a/views/controls/button/native_button_win.cc b/views/controls/button/native_button_win.cc index 6748241..5dd70d3 100644 --- a/views/controls/button/native_button_win.cc +++ b/views/controls/button/native_button_win.cc @@ -4,6 +4,8 @@ #include "views/controls/button/native_button_win.h" +#include + #include "base/logging.h" #include "views/controls/button/checkbox.h" #include "views/controls/button/native_button.h" diff --git a/views/controls/hwnd_view.cc b/views/controls/hwnd_view.cc index 677e60a..fdf4042 100644 --- a/views/controls/hwnd_view.cc +++ b/views/controls/hwnd_view.cc @@ -110,9 +110,10 @@ void HWNDView::ShowWidget(int x, int y, int w, int h) { if (fast_resize()) { // In a fast resize, we move the window and clip it with SetWindowRgn. - CRect rect; - GetWindowRect(native_view(), &rect); - ::SetWindowPos(native_view(), 0, x, y, rect.Width(), rect.Height(), + RECT win_rect; + GetWindowRect(native_view(), &win_rect); + gfx::Rect rect(win_rect); + ::SetWindowPos(native_view(), 0, x, y, rect.width(), rect.height(), swp_flags); HRGN clip_region = CreateRectRgn(0, 0, w, h); diff --git a/views/controls/menu/view_menu_delegate.h b/views/controls/menu/view_menu_delegate.h index bb72ed3..3d6887b 100644 --- a/views/controls/menu/view_menu_delegate.h +++ b/views/controls/menu/view_menu_delegate.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-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. @@ -7,6 +7,10 @@ #include "base/gfx/native_widget_types.h" +namespace gfx { +class Point; +} + namespace views { class View; @@ -25,7 +29,7 @@ class ViewMenuDelegate { // Create and show a menu at the specified position. Source is the view the // ViewMenuDelegate was set on. virtual void RunMenu(View* source, - const CPoint& pt, + const gfx::Point& pt, gfx::NativeView hwnd) = 0; }; diff --git a/views/controls/message_box_view.cc b/views/controls/message_box_view.cc index e0cf055..2ac20af 100644 --- a/views/controls/message_box_view.cc +++ b/views/controls/message_box_view.cc @@ -30,7 +30,7 @@ MessageBoxView::MessageBoxView(int dialog_flags, icon_(NULL), checkbox_(NULL), message_width_(message_width), - focus_grabber_factory_(this) { + ALLOW_THIS_IN_INITIALIZER_LIST(focus_grabber_factory_(this)) { Init(dialog_flags, default_prompt); } @@ -42,7 +42,7 @@ MessageBoxView::MessageBoxView(int dialog_flags, icon_(NULL), checkbox_(NULL), message_width_(kDefaultMessageWidth), - focus_grabber_factory_(this) { + ALLOW_THIS_IN_INITIALIZER_LIST(focus_grabber_factory_(this)) { Init(dialog_flags, default_prompt); } diff --git a/views/controls/native_control.cc b/views/controls/native_control.cc index ce37193..6b0b7df 100644 --- a/views/controls/native_control.cc +++ b/views/controls/native_control.cc @@ -8,6 +8,7 @@ #include #include #include +#include #include "app/l10n_util_win.h" #include "base/logging.h" @@ -127,7 +128,7 @@ class NativeControlContainer : public CWindowImplOnContextMenu(location); } diff --git a/views/controls/native_control.h b/views/controls/native_control.h index 0573168..39022a2 100644 --- a/views/controls/native_control.h +++ b/views/controls/native_control.h @@ -9,6 +9,10 @@ #include "views/view.h" +namespace WTL { +class CPoint; +} + namespace views { class HWNDView; @@ -53,7 +57,7 @@ class NativeControl : public View { virtual LRESULT OnCommand(UINT code, int id, HWND source) { return 0; } // Invoked when the appropriate gesture for a context menu is issued. - virtual void OnContextMenu(const CPoint& location); + virtual void OnContextMenu(const WTL::CPoint& location); // Overridden so to set the native focus to the native control. virtual void Focus(); diff --git a/views/controls/scrollbar/bitmap_scroll_bar.cc b/views/controls/scrollbar/bitmap_scroll_bar.cc index e484517..18096fb 100644 --- a/views/controls/scrollbar/bitmap_scroll_bar.cc +++ b/views/controls/scrollbar/bitmap_scroll_bar.cc @@ -6,6 +6,7 @@ #include "app/gfx/chrome_canvas.h" #include "app/l10n_util.h" +#include "base/compiler_specific.h" #include "base/message_loop.h" #include "grit/generated_resources.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -37,8 +38,9 @@ class AutorepeatButton : public ImageButton { public: AutorepeatButton(ButtonListener* listener) : ImageButton(listener), - repeater_(NewCallback(this, - &AutorepeatButton::NotifyClick)) { + ALLOW_THIS_IN_INITIALIZER_LIST(repeater_( + NewCallback(this, + &AutorepeatButton::NotifyClick))) { } virtual ~AutorepeatButton() {} @@ -255,13 +257,14 @@ class BitmapScrollBarThumb : public View { BitmapScrollBar::BitmapScrollBar(bool horizontal, bool show_scroll_buttons) : contents_size_(0), contents_scroll_offset_(0), - prev_button_(new AutorepeatButton(this)), - next_button_(new AutorepeatButton(this)), - thumb_(new BitmapScrollBarThumb(this)), + ALLOW_THIS_IN_INITIALIZER_LIST(prev_button_(new AutorepeatButton(this))), + ALLOW_THIS_IN_INITIALIZER_LIST(next_button_(new AutorepeatButton(this))), + ALLOW_THIS_IN_INITIALIZER_LIST(thumb_(new BitmapScrollBarThumb(this))), thumb_track_state_(CustomButton::BS_NORMAL), last_scroll_amount_(SCROLL_NONE), - repeater_(NewCallback(this, - &BitmapScrollBar::TrackClicked)), + ALLOW_THIS_IN_INITIALIZER_LIST(repeater_( + NewCallback(this, + &BitmapScrollBar::TrackClicked))), context_menu_mouse_position_(0), show_scroll_buttons_(show_scroll_buttons), ScrollBar(horizontal) { diff --git a/views/controls/table/group_table_view.cc b/views/controls/table/group_table_view.cc index 5e6a155..b5d5698 100644 --- a/views/controls/table/group_table_view.cc +++ b/views/controls/table/group_table_view.cc @@ -5,6 +5,7 @@ #include "views/controls/table/group_table_view.h" #include "app/gfx/chrome_canvas.h" +#include "base/compiler_specific.h" #include "base/message_loop.h" #include "base/task.h" @@ -24,7 +25,7 @@ GroupTableView::GroupTableView(GroupTableModel* model, : TableView(model, columns, table_type, false, resizable_columns, autosize_columns), model_(model), - sync_selection_factory_(this) { + ALLOW_THIS_IN_INITIALIZER_LIST(sync_selection_factory_(this)) { } GroupTableView::~GroupTableView() { @@ -165,22 +166,22 @@ void GroupTableView::OnSelectedStateChanged() { // Draws the line separator betweens the groups. void GroupTableView::PostPaint(int model_row, int column, bool selected, - const CRect& bounds, HDC hdc) { + const gfx::Rect& bounds, HDC hdc) { GroupRange group_range; model_->GetGroupRangeForItem(model_row, &group_range); // We always paint a vertical line at the end of the last cell. HPEN hPen = CreatePen(PS_SOLID, kSeparatorLineThickness, kSeparatorLineColor); HPEN hPenOld = (HPEN) SelectObject(hdc, hPen); - int x = static_cast(bounds.right - kSeparatorLineThickness); - MoveToEx(hdc, x, bounds.top, NULL); - LineTo(hdc, x, bounds.bottom); + int x = static_cast(bounds.right() - kSeparatorLineThickness); + MoveToEx(hdc, x, bounds.y(), NULL); + LineTo(hdc, x, bounds.bottom()); // We paint a separator line after the last item of a group. if (model_row == (group_range.start + group_range.length - 1)) { - int y = static_cast(bounds.bottom - kSeparatorLineThickness); + int y = static_cast(bounds.bottom() - kSeparatorLineThickness); MoveToEx(hdc, 0, y, NULL); - LineTo(hdc, bounds.Width(), y); + LineTo(hdc, bounds.width(), y); } SelectObject(hdc, hPenOld); DeleteObject(hPen); diff --git a/views/controls/table/group_table_view.h b/views/controls/table/group_table_view.h index d128759..e581d5d 100644 --- a/views/controls/table/group_table_view.h +++ b/views/controls/table/group_table_view.h @@ -48,7 +48,7 @@ class GroupTableView : public TableView { // Extra-painting required to draw the separator line between groups. virtual bool ImplementPostPaint() { return true; } virtual void PostPaint(int model_row, int column, bool selected, - const CRect& bounds, HDC device_context); + const gfx::Rect& bounds, HDC device_context); // In order to make keyboard navigation possible (using the Up and Down // keys), we must take action when an arrow key is pressed. The reason we diff --git a/views/controls/table/table_view.cc b/views/controls/table/table_view.cc index 5ab86d3..0f7d6b9 100644 --- a/views/controls/table/table_view.cc +++ b/views/controls/table/table_view.cc @@ -4,8 +4,12 @@ #include "views/controls/table/table_view.h" -#include #include +#include +#include +#include + +#include #include "app/gfx/chrome_canvas.h" #include "app/gfx/favicon_size.h" @@ -95,7 +99,7 @@ TableView::TableView(TableModel* model, list_view_(NULL), header_original_handler_(NULL), original_handler_(NULL), - table_view_wrapper_(this), + ALLOW_THIS_IN_INITIALIZER_LIST(table_view_wrapper_(this)), custom_cell_font_(NULL), content_offset_(0) { for (std::vector::const_iterator i = columns.begin(); @@ -574,10 +578,10 @@ LRESULT CALLBACK TableView::TableWndProc(HWND window, // the position supplied in the l_param. if (table_view->UILayoutIsRightToLeft() && (GET_X_LPARAM(l_param) != -1 || GET_Y_LPARAM(l_param) != -1)) { - CPoint screen_point; + WTL::CPoint screen_point; GetCursorPos(&screen_point); - CPoint table_point = screen_point; - CRect client_rect; + WTL::CPoint table_point = screen_point; + WTL::CRect client_rect; if (ScreenToClient(window, &table_point) && GetClientRect(window, &client_rect) && client_rect.PtInRect(table_point)) { @@ -1231,11 +1235,11 @@ LRESULT TableView::OnCustomDraw(NMLVCUSTOMDRAW* draw_info) { SkBitmap image = model_->GetIcon(model_index); if (!image.isNull()) { // Get the rect that holds the icon. - CRect icon_rect, client_rect; + WTL::CRect icon_rect, client_rect; if (ListView_GetItemRect(list_view_, view_index, &icon_rect, LVIR_ICON) && GetClientRect(list_view_, &client_rect)) { - CRect intersection; + WTL::CRect intersection; // Client rect includes the header but we need to make sure we don't // paint into it. client_rect.top += content_offset_; @@ -1287,10 +1291,11 @@ LRESULT TableView::OnCustomDraw(NMLVCUSTOMDRAW* draw_info) { } } if (ImplementPostPaint()) { - CRect cell_rect; + WTL::CRect cell_rect; if (ListView_GetItemRect(list_view_, view_index, &cell_rect, LVIR_BOUNDS)) { - PostPaint(model_index, 0, false, cell_rect, draw_info->nmcd.hdc); + PostPaint(model_index, 0, false, gfx::Rect(cell_rect), + draw_info->nmcd.hdc); r = CDRF_SKIPDEFAULT; } } @@ -1313,7 +1318,7 @@ void TableView::ResetColumnSizes() { // See comment in TableColumn for what this does. int width = this->width(); - CRect native_bounds; + WTL::CRect native_bounds; if (GetClientRect(GetNativeControlHWND(), &native_bounds) && native_bounds.Width() > 0) { // Prefer the bounds of the window over our bounds, which may be different. @@ -1524,7 +1529,7 @@ void TableView::UpdateContentOffset() { POINT origin = {0, 0}; MapWindowPoints(header, list_view_, &origin, 1); - CRect header_bounds; + WTL::CRect header_bounds; GetWindowRect(header, &header_bounds); content_offset_ = origin.y + header_bounds.Height(); diff --git a/views/controls/table/table_view.h b/views/controls/table/table_view.h index 2db5234..da228fc 100644 --- a/views/controls/table/table_view.h +++ b/views/controls/table/table_view.h @@ -9,6 +9,7 @@ #if defined(OS_WIN) #include +typedef struct tagNMLVCUSTOMDRAW NMLVCUSTOMDRAW; #endif // defined(OS_WIN) #include @@ -470,7 +471,7 @@ class TableView : public NativeControl, virtual bool ImplementPostPaint() { return false; } // Subclasses can implement in this method extra-painting for cells. virtual void PostPaint(int model_row, int column, bool selected, - const CRect& bounds, HDC device_context) { } + const gfx::Rect& bounds, HDC device_context) { } virtual void PostPaint() {} virtual HWND CreateNativeControl(HWND parent_container); diff --git a/views/controls/text_field.cc b/views/controls/text_field.cc index 0395af3..6fd9c3e 100644 --- a/views/controls/text_field.cc +++ b/views/controls/text_field.cc @@ -8,6 +8,7 @@ #include #include #include +#include #include // For ITextDocument, a COM interface to CRichEditCtrl #include diff --git a/views/controls/tree/tree_view.cc b/views/controls/tree/tree_view.cc index 894aa6e..d6f6627 100644 --- a/views/controls/tree/tree_view.cc +++ b/views/controls/tree/tree_view.cc @@ -4,7 +4,9 @@ #include "views/controls/tree/tree_view.h" -#include +#include +#include +#include #include "app/gfx/chrome_canvas.h" #include "app/gfx/icon_util.h" @@ -30,7 +32,7 @@ TreeView::TreeView() process_enter_(false), show_context_menu_only_when_node_selected_(true), select_on_right_mouse_down_(true), - wrapper_(this), + ALLOW_THIS_IN_INITIALIZER_LIST(wrapper_(this)), original_handler_(NULL), drag_enabled_(false), has_custom_icons_(false), @@ -481,7 +483,7 @@ bool TreeView::OnKeyDown(int virtual_key_code) { return false; } -void TreeView::OnContextMenu(const CPoint& location) { +void TreeView::OnContextMenu(const WTL::CPoint& location) { if (!GetContextMenuController()) return; diff --git a/views/controls/tree/tree_view.h b/views/controls/tree/tree_view.h index 1ded058..fe470c0 100644 --- a/views/controls/tree/tree_view.h +++ b/views/controls/tree/tree_view.h @@ -5,6 +5,9 @@ #ifndef VIEWS_CONTROLS_TREE_TREE_VIEW_H_ #define VIEWS_CONTROLS_TREE_TREE_VIEW_H_ +#include +#include + #include #include "base/basictypes.h" @@ -159,7 +162,7 @@ class TreeView : public NativeControl, TreeModelObserver { virtual bool NotifyOnKeyDown() const { return true; } virtual bool OnKeyDown(int virtual_key_code); - virtual void OnContextMenu(const CPoint& location); + virtual void OnContextMenu(const WTL::CPoint& location); // Returns the TreeModelNode for |tree_item|. TreeModelNode* GetNodeForTreeItem(HTREEITEM tree_item); diff --git a/views/grid_layout_unittest.cc b/views/grid_layout_unittest.cc index 57bfa83..cd38fc8 100644 --- a/views/grid_layout_unittest.cc +++ b/views/grid_layout_unittest.cc @@ -53,7 +53,7 @@ class GridLayoutTest : public testing::Test { } gfx::Size pref; - CRect bounds; + gfx::Rect bounds; View host; GridLayout* layout; }; @@ -78,7 +78,7 @@ class GridLayoutAlignmentTest : public testing::Test { } } - void TestAlignment(GridLayout::Alignment alignment, CRect* bounds) { + void TestAlignment(GridLayout::Alignment alignment, gfx::Rect* bounds) { ColumnSet* c1 = layout->AddColumnSet(0); c1->AddColumn(alignment, alignment, 1, GridLayout::USE_PREF, 0, 0); layout->StartRow(1, 0); @@ -87,7 +87,7 @@ class GridLayoutAlignmentTest : public testing::Test { EXPECT_TRUE(gfx::Size(10, 20) == pref); host.SetBounds(0, 0, 100, 100); layout->Layout(&host); - *bounds = v1.bounds().ToRECT(); + *bounds = v1.bounds(); RemoveAll(); } @@ -97,27 +97,27 @@ class GridLayoutAlignmentTest : public testing::Test { }; TEST_F(GridLayoutAlignmentTest, Fill) { - CRect bounds; + gfx::Rect bounds; TestAlignment(GridLayout::FILL, &bounds); - EXPECT_TRUE(CRect(0, 0, 100, 100) == bounds); + EXPECT_TRUE(gfx::Rect(0, 0, 100, 100) == bounds); } TEST_F(GridLayoutAlignmentTest, Leading) { - CRect bounds; + gfx::Rect bounds; TestAlignment(GridLayout::LEADING, &bounds); - EXPECT_TRUE(CRect(0, 0, 10, 20) == bounds); + EXPECT_TRUE(gfx::Rect(0, 0, 10, 20) == bounds); } TEST_F(GridLayoutAlignmentTest, Center) { - CRect bounds; + gfx::Rect bounds; TestAlignment(GridLayout::CENTER, &bounds); - EXPECT_TRUE(CRect(45, 40, 55, 60) == bounds); + EXPECT_TRUE(gfx::Rect(45, 40, 55, 60) == bounds); } TEST_F(GridLayoutAlignmentTest, Trailing) { - CRect bounds; + gfx::Rect bounds; TestAlignment(GridLayout::TRAILING, &bounds); - EXPECT_TRUE(CRect(90, 80, 100, 100) == bounds); + EXPECT_TRUE(gfx::Rect(90, 80, 100, 100) == bounds); } TEST_F(GridLayoutTest, TwoColumns) { diff --git a/views/view.h b/views/view.h index ed4d4a0..e5360213 100644 --- a/views/view.h +++ b/views/view.h @@ -7,12 +7,6 @@ #include "build/build_config.h" -#if defined(OS_WIN) -#include -#include -#include -#endif // defined(OS_WIN) - #include #include #include @@ -25,6 +19,10 @@ #include "views/background.h" #include "views/border.h" +#if defined(OS_WIN) +struct IDataObject; +#endif // defined(OS_WIN) + namespace gfx { class Insets; class Path; diff --git a/views/widget/root_view_drop_target.h b/views/widget/root_view_drop_target.h index a3c3afd..32cb14b 100644 --- a/views/widget/root_view_drop_target.h +++ b/views/widget/root_view_drop_target.h @@ -5,10 +5,6 @@ #ifndef VIEWS_WIDGET_ROOT_VIEW_DROP_TARGET_H_ #define VIEWS_WIDGET_ROOT_VIEW_DROP_TARGET_H_ -#include -#include -#include - #include "app/os_exchange_data.h" #include "base/base_drop_target.h" diff --git a/views/widget/tooltip_manager.cc b/views/widget/tooltip_manager.cc index 59612e4..c082040 100644 --- a/views/widget/tooltip_manager.cc +++ b/views/widget/tooltip_manager.cc @@ -4,6 +4,7 @@ #include "views/widget/tooltip_manager.h" +#include #include #include "app/gfx/text_elider.h" diff --git a/views/widget/widget_win.h b/views/widget/widget_win.h index d948e66..b39362f 100644 --- a/views/widget/widget_win.h +++ b/views/widget/widget_win.h @@ -6,7 +6,9 @@ #define VIEWS_WIDGET_WIDGET_WIN_H_ #include +#include #include +#include #include "base/message_loop.h" #include "base/system_monitor.h" @@ -36,7 +38,7 @@ RootView* GetRootViewForHWND(HWND hwnd); // uMsg - kReflectedMessage // wParam - Should be 0 // lParam - Pointer to MSG struct containing the original message. -static const int kReflectedMessage = WM_APP + 3; +const int kReflectedMessage = WM_APP + 3; // These two messages aren't defined in winuser.h, but they are sent to windows // with captions. They appear to paint the window caption and frame. @@ -46,8 +48,8 @@ static const int kReflectedMessage = WM_APP + 3; // window and paint the standard caption/title over the top of the custom one. // So we need to handle these messages in CustomFrameWindow to prevent this // from happening. -static const int WM_NCUAHDRAWCAPTION = 0xAE; -static const int WM_NCUAHDRAWFRAME = 0xAF; +const int WM_NCUAHDRAWCAPTION = 0xAE; +const int WM_NCUAHDRAWFRAME = 0xAF; /////////////////////////////////////////////////////////////////////////////// // diff --git a/views/window/custom_frame_view.cc b/views/window/custom_frame_view.cc index 66e2ccd..19ce2fb 100644 --- a/views/window/custom_frame_view.cc +++ b/views/window/custom_frame_view.cc @@ -74,11 +74,12 @@ const int kCaptionTopSpacing = 1; CustomFrameView::CustomFrameView(Window* frame) : NonClientFrameView(), - close_button_(new ImageButton(this)), - restore_button_(new ImageButton(this)), - maximize_button_(new ImageButton(this)), - minimize_button_(new ImageButton(this)), - system_menu_button_(new ImageButton(this)), + ALLOW_THIS_IN_INITIALIZER_LIST(close_button_(new ImageButton(this))), + ALLOW_THIS_IN_INITIALIZER_LIST(restore_button_(new ImageButton(this))), + ALLOW_THIS_IN_INITIALIZER_LIST(maximize_button_(new ImageButton(this))), + ALLOW_THIS_IN_INITIALIZER_LIST(minimize_button_(new ImageButton(this))), + ALLOW_THIS_IN_INITIALIZER_LIST( + system_menu_button_(new ImageButton(this))), should_show_minmax_buttons_(false), frame_(frame) { InitClass(); diff --git a/views/window/window_win.h b/views/window/window_win.h index 76d5196..5a90835 100644 --- a/views/window/window_win.h +++ b/views/window/window_win.h @@ -6,8 +6,6 @@ #define VIEWS_WINDOW_WINDOW_WIN_H_ #include "views/widget/widget_win.h" -#include "views/window/client_view.h" -#include "views/window/non_client_view.h" #include "views/window/window.h" namespace gfx { diff --git a/webkit/tools/test_shell/foreground_helper.h b/webkit/tools/test_shell/foreground_helper.h index 3d62b46..3718e02 100644 --- a/webkit/tools/test_shell/foreground_helper.h +++ b/webkit/tools/test_shell/foreground_helper.h @@ -16,9 +16,9 @@ // This is probably leveraging a windows bug. class ForegroundHelper : public CWindowImpl { public: -BEGIN_MSG_MAP(ForegroundHelper) - MESSAGE_HANDLER(WM_HOTKEY, OnHotKey) -END_MSG_MAP() + BEGIN_MSG_MAP(ForegroundHelper) + MESSAGE_HANDLER(WM_HOTKEY, OnHotKey) + END_MSG_MAP() // Brings a window into the foreground. // Can be called from any window, even if the caller is not the @@ -37,7 +37,7 @@ END_MSG_MAP() // be in the foreground and allowed to move the target window // into the foreground too. - if(NULL == Create(NULL, NULL, NULL, WS_POPUP)) + if (NULL == Create(NULL, NULL, NULL, WS_POPUP)) return AtlHresultFromLastError(); static const int hotkey_id = 0x0000baba; @@ -62,11 +62,11 @@ END_MSG_MAP() // Loop until we get the key. // TODO: It may be possible to get stuck here if the // message gets lost? - while(GetMessage(&msg, NULL, 0, 0)) { + while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); - if(WM_HOTKEY == msg.message) + if (WM_HOTKEY == msg.message) break; } @@ -78,7 +78,7 @@ END_MSG_MAP() // Handle the registered Hotkey being pressed. LRESULT OnHotKey(UINT /*uMsg*/, WPARAM /*wParam*/, - LPARAM /*lParam*/, BOOL& bHandled) { + LPARAM /*lParam*/, BOOL& bHandled) { HWND window = reinterpret_cast(GetWindowLongPtr(GWLP_USERDATA)); SetForegroundWindow(window); return 1; -- cgit v1.1