diff options
author | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-07-30 04:48:39 +0000 |
---|---|---|
committer | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-07-30 04:48:39 +0000 |
commit | f3e99e3d1dd8d37c7d0e37daa24df7717cd7783b (patch) | |
tree | 4d46a6020077f2385a8720882e76158ce878f432 | |
parent | 43a973aeb04b5d0ac64bb730cadf0737de8b0cd9 (diff) | |
download | chromium_src-f3e99e3d1dd8d37c7d0e37daa24df7717cd7783b.zip chromium_src-f3e99e3d1dd8d37c7d0e37daa24df7717cd7783b.tar.gz chromium_src-f3e99e3d1dd8d37c7d0e37daa24df7717cd7783b.tar.bz2 |
Rename ChromeFrame->BrowserWindow
Move static utility functions to FrameUtil class.
B=1294302
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102 0039d316-1c4b-4281-b951-d872f2087c98
24 files changed, 224 insertions, 172 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index 03abe8b..fa4f63f 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -35,7 +35,7 @@ #include "chrome/browser/automation/url_request_failed_dns_job.h" #include "chrome/browser/automation/url_request_mock_http_job.h" #include "chrome/browser/automation/url_request_slow_download_job.h" -#include "chrome/browser/chrome_frame.h" +#include "chrome/browser/browser_window.h" #include "chrome/browser/dom_operation_notification_details.h" #include "chrome/browser/download_manager.h" #include "chrome/browser/external_tab_container.h" @@ -1258,7 +1258,7 @@ void AutomationProvider::WindowSimulateDrag(const IPC::Message& message, Browser* browser = browser_tracker_->GetResource(handle); DCHECK(browser); - ChromeViews::RootView* root = browser->frame()->GetRootView(); + ChromeViews::RootView* root = browser->window()->GetRootView(); DCHECK(root); ScheduleMouseEvent(root, ChromeViews::Event::ET_MOUSE_PRESSED, drag_path[0], flags); @@ -1844,7 +1844,7 @@ void AutomationProvider::CloseBrowser(const IPC::Message& message, if (browser_tracker_->ContainsHandle(browser_handle)) { Browser* browser = browser_tracker_->GetResource(browser_handle); new BrowserClosedNotificationObserver(browser, this, message.routing_id()); - browser->frame()->Close(); + browser->window()->Close(); } else { NOTREACHED(); } diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 3795b14..8c623b2 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -41,6 +41,7 @@ #include "chrome/browser/browser_shutdown.h" #include "chrome/browser/browser_url_handler.h" #include "chrome/browser/cert_store.h" +#include "chrome/browser/frame_util.h" #include "chrome/browser/navigation_controller.h" #include "chrome/browser/navigation_entry.h" #include "chrome/browser/plugin_process_host.h" @@ -205,7 +206,7 @@ Browser::Browser(const gfx::Rect& initial_bounds, BrowserType::Type type, const std::wstring& app_name) : profile_(profile), - frame_(NULL), + window_(NULL), initial_show_command_(show_command), is_processing_tab_unload_events_(false), controller_(this), @@ -231,7 +232,7 @@ Browser::Browser(const gfx::Rect& initial_bounds, maximized = true; if (maximized) initial_show_command_ = SW_SHOWMAXIMIZED; - frame_ = ChromeFrame::CreateChromeFrame(create_bounds, this); + window_ = FrameUtil::CreateBrowserWindow(create_bounds, this); toolbar_.SetID(VIEW_ID_TOOLBAR); toolbar_.Init(profile_); @@ -241,7 +242,7 @@ Browser::Browser(const gfx::Rect& initial_bounds, if (show_command == SIZE_TO_CONTENTS) { // SizeToContents causes a Layout so make sure the tab strip and toolbar // are already initialized. - frame_->SizeToContents(initial_bounds); + window_->SizeToContents(initial_bounds); initial_show_command_ = SW_SHOWNORMAL; } @@ -340,13 +341,13 @@ void Browser::ShowAndFit(bool resize_to_fit) { if (initial_show_command_ < 0) { // The frame is already visible, we're being invoked again either by the // user clicking a link in another app or from a desktop shortcut. - frame_->Activate(); + window_->Activate(); return; } - frame_->Show(initial_show_command_, resize_to_fit); + window_->Show(initial_show_command_, resize_to_fit); if ((initial_show_command_ == SW_SHOWNORMAL) || (initial_show_command_ == SW_SHOWMAXIMIZED)) - frame_->Activate(); + window_->Activate(); initial_show_command_ = -1; // Setting the focus doesn't work when the window is invisible, so any focus @@ -365,7 +366,7 @@ void Browser::ShowAndFit(bool resize_to_fit) { } void Browser::CloseFrame() { - frame_->Close(); + window_->Close(); } ChromeViews::View* Browser::GetToolbar() { @@ -377,11 +378,11 @@ ChromeViews::View* Browser::GetToolbar() { void Browser::SyncWindowTitle() { TabContents* current_tab = GetSelectedTabContents(); if (!current_tab || current_tab->GetTitle().empty()) { - frame_->SetWindowTitle(l10n_util::GetString(IDS_PRODUCT_NAME)); + window_->SetWindowTitle(l10n_util::GetString(IDS_PRODUCT_NAME)); return; } - frame_->SetWindowTitle( + window_->SetWindowTitle( l10n_util::GetStringF(IDS_BROWSER_WINDOW_TITLE_FORMAT, current_tab->GetTitle())); } @@ -501,7 +502,7 @@ void Browser::ProcessPendingUIUpdates() { if (invalidate_tab) { // INVALIDATE_TITLE or INVALIDATE_FAVICON. tabstrip_model_.UpdateTabContentsStateAt( tabstrip_model_.GetIndexOfController(contents->controller())); - frame_->UpdateTitleBar(); + window_->UpdateTitleBar(); if (contents == GetSelectedTabContents()) { TabContents* current_tab = GetSelectedTabContents(); @@ -713,24 +714,24 @@ void Browser::StartDraggingDetachedContents(TabContents* source, browser->AddNewContents( source, new_contents, NEW_FOREGROUND_TAB, contents_bounds, true); browser->Show(); - browser->frame_->ContinueDetachConstrainedWindowDrag( + browser->window_->ContinueDetachConstrainedWindowDrag( mouse_pt, frame_component); } void Browser::ActivateContents(TabContents* contents) { tabstrip_model_.SelectTabContentsAt( tabstrip_model_.GetIndexOfTabContents(contents), false); - frame_->Activate(); + window_->Activate(); } HWND Browser::GetTopLevelHWND() const { - return frame_ ? reinterpret_cast<HWND>(frame_->GetPlatformID()) : NULL; + return window_ ? reinterpret_cast<HWND>(window_->GetPlatformID()) : NULL; } void Browser::LoadingStateChanged(TabContents* source) { tabstrip_model_.UpdateTabContentsLoadingAnimations(); - frame_->UpdateTitleBar(); + window_->UpdateTitleBar(); // Let the go button know that it should change appearance if possible. if (source == GetSelectedTabContents()) { @@ -785,7 +786,7 @@ void Browser::Observe(NotificationType type, Profile* event_profile = Source<Profile>(source).ptr(); if (event_profile->IsSameProfile(current_tab->profile())) { // This forces the browser to query for the BookmarkBar again. - frame_->ShelfVisibilityChanged(); + window_->ShelfVisibilityChanged(); } } } else if (type == NOTIFY_WEB_CONTENTS_DISCONNECTED) { @@ -857,7 +858,7 @@ void Browser::URLStarredChanged(TabContents* source, bool starred) { } StatusBubble* Browser::GetStatusBubble() { - return frame_->GetStatusBubble(); + return window_->GetStatusBubble(); } // Called whenever the window is moved so that we can update the position @@ -940,7 +941,7 @@ void Browser::SaveWindowPlacementToDatabase() { WINDOWPLACEMENT wp; wp.length = sizeof(wp); - HWND hwnd = reinterpret_cast<HWND>(frame_->GetPlatformID()); + HWND hwnd = reinterpret_cast<HWND>(window_->GetPlatformID()); if (!::GetWindowPlacement(hwnd, &wp)) return; @@ -953,7 +954,7 @@ void Browser::SaveWindowPlacement() { WINDOWPLACEMENT wp; wp.length = sizeof(wp); - HWND hwnd = reinterpret_cast<HWND>(frame_->GetPlatformID()); + HWND hwnd = reinterpret_cast<HWND>(window_->GetPlatformID()); if (!::GetWindowPlacement(hwnd, &wp)) return; @@ -998,12 +999,12 @@ void Browser::SyncHistoryWithTabs(int index) { void Browser::ToolbarSizeChanged(TabContents* source, bool is_animating) { if (source == GetSelectedTabContents() || source == NULL) { // This will refresh the shelf if needed. - frame_->SelectedTabToolbarSizeChanged(is_animating); + window_->SelectedTabToolbarSizeChanged(is_animating); } } void Browser::MoveToFront(bool should_activate) { - frame_->Activate(); + window_->Activate(); } bool Browser::ShouldCloseWindow() { @@ -1237,7 +1238,7 @@ void Browser::CreateNewStripWithContents(TabContents* detached_contents, // Create an empty new browser window the same size as the old one. CRect browser_rect; - GetWindowRect(reinterpret_cast<HWND>(frame_->GetPlatformID()), &browser_rect); + GetWindowRect(reinterpret_cast<HWND>(window_->GetPlatformID()), &browser_rect); gfx::Rect rect(0, 0); if (drop_point.x() != 0 || drop_point.y() != 0) { rect.SetRect(drop_point.x(), drop_point.y(), browser_rect.Width(), @@ -1290,10 +1291,10 @@ TabContents* Browser::CreateTabContentsForURL( } void Browser::ShowApplicationMenu(const gfx::Point p) { - if (!frame_) + if (!window_) return; - HWND hwnd = reinterpret_cast<HWND>(frame_->GetPlatformID()); + HWND hwnd = reinterpret_cast<HWND>(window_->GetPlatformID()); CPoint t; t.x = p.x(); t.y = p.y(); @@ -1301,8 +1302,8 @@ void Browser::ShowApplicationMenu(const gfx::Point p) { } void Browser::ValidateLoadingAnimations() { - if (frame_) - frame_->ValidateThrobber(); + if (window_) + window_->ValidateThrobber(); } void Browser::CloseFrameAfterDragSession() { @@ -1354,7 +1355,7 @@ void Browser::TabClosingAt(TabContents* contents, int index) { // We need to reset the current tab contents to NULL before it gets // freed. This is because the focus manager performs some operation // on the selected tab contents when it is removed. - frame_->ShowTabContents(NULL); + window_->ShowTabContents(NULL); } } @@ -1395,7 +1396,7 @@ void Browser::TabSelectedAt(TabContents* old_contents, } // Tell the frame what happened so that the TabContents gets resized, etc. - frame_->ShowTabContents(new_contents); + window_->ShowTabContents(new_contents); // Inform the tab that it is now selected. new_contents->DidBecomeSelected(); @@ -1447,7 +1448,7 @@ void Browser::TabMoved(TabContents* contents, void Browser::TabStripEmpty() { // We need to reset the frame contents just in case this wasn't done while // detaching the tab. This happens when dragging out the last tab. - frame_->ShowTabContents(NULL); + window_->ShowTabContents(NULL); // Close the frame after we return to the message loop (not immediately, // otherwise it will destroy this object before the stack has a chance to @@ -1616,7 +1617,7 @@ void Browser::BuildPopupWindow(TabContents* source, // numbers are for the content area, but x/y are for the actual // window position. Thus we can't just call MoveContents(). gfx::Rect window_rect = - browser->frame()->GetBoundsForContentBounds(initial_pos); + browser->window()->GetBoundsForContentBounds(initial_pos); window_rect.set_origin(initial_pos.origin()); ::SetWindowPos(browser->GetTopLevelHWND(), NULL, window_rect.x(), window_rect.y(), diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h index 58d6324..9c22d7f 100644 --- a/chrome/browser/browser.h +++ b/chrome/browser/browser.h @@ -48,7 +48,7 @@ #include "chrome/common/pref_member.h" class BookmarkBarView; -class ChromeFrame; +class BrowserWindow; class GoButton; class LocationBarView; class PrefService; @@ -146,7 +146,7 @@ class Browser : public TabStripModelDelegate, Profile* profile() const { return profile_; } - ChromeFrame* frame() const { return frame_; } + BrowserWindow* window() const { return window_; } ToolbarModel* toolbar_model() { return &toolbar_model_; } @@ -528,7 +528,7 @@ class Browser : public TabStripModelDelegate, void ClearUnloadStateOnCrash(TabContents* tab); // The frame - ChromeFrame* frame_; + BrowserWindow* window_; // Controls how the window will appear when Show() is called. This is one // of the SW_* constants passed to ShowWindow, and will be initialized in the diff --git a/chrome/browser/browser.vcproj b/chrome/browser/browser.vcproj index cd7855f..f6b4b01 100644 --- a/chrome/browser/browser.vcproj +++ b/chrome/browser/browser.vcproj @@ -1006,11 +1006,7 @@ > </File> <File - RelativePath=".\chrome_frame.cc" - > - </File> - <File - RelativePath=".\chrome_frame.h" + RelativePath=".\browser_window.h" > </File> <File @@ -1042,6 +1038,14 @@ > </File> <File + RelativePath=".\frame_util.cc" + > + </File> + <File + RelativePath=".\frame_util.h" + > + </File> + <File RelativePath=".\frame_view.cc" > </File> diff --git a/chrome/browser/browser_commands.cc b/chrome/browser/browser_commands.cc index 3b5d201..686016d 100644 --- a/chrome/browser/browser_commands.cc +++ b/chrome/browser/browser_commands.cc @@ -47,8 +47,8 @@ #include "chrome/browser/browser_list.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_shutdown.h" +#include "chrome/browser/browser_window.h" #include "chrome/browser/character_encoding.h" -#include "chrome/browser/chrome_frame.h" #include "chrome/browser/dom_ui/new_tab_ui.h" #include "chrome/browser/download_tab_view.h" #include "chrome/browser/history_tab_ui.h" @@ -362,7 +362,7 @@ void Browser::ExecuteCommand(int id) { case IDC_CLOSEWINDOW: UserMetrics::RecordAction(L"CloseWindow", profile_); - frame_->Close(); + window_->Close(); break; case IDC_FOCUS_LOCATION: diff --git a/chrome/browser/browser_list.cc b/chrome/browser/browser_list.cc index 12b2cbb..091a292 100644 --- a/chrome/browser/browser_list.cc +++ b/chrome/browser/browser_list.cc @@ -32,7 +32,7 @@ #include "base/logging.h" #include "base/message_loop.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/chrome_frame.h" +#include "chrome/browser/browser_window.h" #include "chrome/browser/profile.h" #include "chrome/browser/profile_manager.h" #include "chrome/browser/web_contents.h" @@ -140,13 +140,13 @@ void BrowserList::CloseAllBrowsers(bool use_post) { // This path is hit during logoff/power-down. In this case we won't get // a final message and so we force the browser to be deleted. Browser* browser = *iter; - browser->frame()->Close(); + browser->window()->Close(); // Close doesn't immediately destroy the browser // (Browser::TabStripEmpty() uses invoke later) but when we're ending the // session we need to make sure the browser is destroyed now. So, invoke // DestroyBrowser to make sure the browser is deleted and cleanup can // happen. - browser->frame()->DestroyBrowser(); + browser->window()->DestroyBrowser(); iter = BrowserList::begin(); if (iter != BrowserList::end() && browser == *iter) { // Destroying the browser should have removed it from the browser list. diff --git a/chrome/browser/chrome_frame.h b/chrome/browser/browser_window.h index 4af845e..8f5a0da 100644 --- a/chrome/browser/chrome_frame.h +++ b/chrome/browser/browser_window.h @@ -27,37 +27,29 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#ifndef CHROME_BROWSER_CHROME_FRAME_H__ -#define CHROME_BROWSER_CHROME_FRAME_H__ +#ifndef CHROME_BROWSER_BROWSER_WINDOW_H_ +#define CHROME_BROWSER_BROWSER_WINDOW_H_ #include <map> -#include <string> -#include <windows.h> #include "base/gfx/point.h" #include "base/gfx/rect.h" -#include "chrome/browser/views/status_bubble.h" #include "chrome/views/accelerator.h" -class Browser; class BrowserList; namespace ChromeViews { - class RootView; +class RootView; } +class StatusBubble; class TabContents; class TabStrip; //////////////////////////////////////////////////////////////////////////////// +// BrowserWindow interface +// An interface implemented by the "view" of the Browser window. // -// ChromeFrame class -// -// An abstract class to define the methods implemented by chrome's frames. We -// currently have 2 implementations. One for vista and one for XP. -// -//////////////////////////////////////////////////////////////////////////////// -class ChromeFrame { +class BrowserWindow { public: - // Initialize the frame. virtual void Init() = 0; @@ -138,7 +130,7 @@ class ChromeFrame { // Set the accelerator table. This is called once after LoadAccelerators // has been called on the frame. The callee becomes the owner of the passed // map. The map associates accelerators with command ids. - // Note if you are not calling ChromeFrame::LoadAccelerators() on this frame, + // Note if you are not calling FrameUtil::LoadAccelerators() on this frame, // this method is never invoked. virtual void SetAcceleratorTable( std::map<ChromeViews::Accelerator, int>* accelerator_table) = 0; @@ -175,39 +167,16 @@ class ChromeFrame { // The implementation for this sends WM_NCACTIVATE with a value of FALSE for // the window. Subclasses that need to customize should be sure and invoke // this implementation too. - virtual void InfoBubbleClosing(); - - // Mark the frame such as it can be retrieved using GetChromeFrameForWindow() - static void RegisterChromeFrame(ChromeFrame* frame); - - // Return a ChromeFrame instance given an hwnd. - static ChromeFrame* GetChromeFrameForWindow(HWND hwnd); - - // Create a ChromeFrame for the given browser. - static ChromeFrame* CreateChromeFrame(const gfx::Rect& bounds, - Browser* browser); - - // Initialize the accelerators for that frame. - static bool LoadAccelerators(ChromeFrame* frame, - HACCEL accelerator_table, - ChromeViews::AcceleratorTarget* accelerator_target); - - // Activate any app modal dialog that might be present. Returns true if one - // was present. - static bool ActivateAppModalDialog(Browser* browser); + virtual void InfoBubbleClosing() { + // TODO(beng): (Cleanup) - move out of here! + HWND hwnd = static_cast<HWND>(GetPlatformID()); + // The frame is really inactive, send notification now. + DefWindowProc(hwnd, WM_NCACTIVATE, FALSE, 0); + } protected: friend class BrowserList; - - // Invoked when windows is shutting down (or the user is logging off). When - // this method returns windows is going to kill our process. As such, this - // blocks until the shtudown has been marked as clean. - static void EndSession(); - - // Notifies all tabs with associated webcontents of theme changes. - void NotifyTabsOfThemeChange(Browser* browser); - virtual void DestroyBrowser() = 0; }; -#endif // CHROME_BROWSER_CHROME_FRAME_H__ +#endif // #ifndef CHROME_BROWSER_BROWSER_WINDOW_H__ diff --git a/chrome/browser/chrome_frame.cc b/chrome/browser/frame_util.cc index 422d01b..949d5c7 100644 --- a/chrome/browser/chrome_frame.cc +++ b/chrome/browser/frame_util.cc @@ -27,7 +27,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#include "chrome/browser/chrome_frame.h" +#include "chrome/browser/frame_util.h" #include "base/message_loop.h" #include "chrome/app/result_codes.h" @@ -48,13 +48,13 @@ #include "chrome/views/focus_manager.h" // static -void ChromeFrame::RegisterChromeFrame(ChromeFrame* frame) { +void FrameUtil::RegisterBrowserWindow(BrowserWindow* frame) { HWND h = reinterpret_cast<HWND>(frame->GetPlatformID()); win_util::SetWindowUserData(h, frame); } // static -ChromeFrame* ChromeFrame::GetChromeFrameForWindow(HWND hwnd) { +BrowserWindow* FrameUtil::GetBrowserWindowForHWND(HWND hwnd) { if (hwnd) { std::wstring class_name = win_util::GetClassName(hwnd); if (class_name == VISTA_FRAME_CLASSNAME || @@ -62,16 +62,16 @@ ChromeFrame* ChromeFrame::GetChromeFrameForWindow(HWND hwnd) { // Need to check for both, as it's possible to have vista and xp frames // at the same time (you can get into this state when connecting via // remote desktop to a vista machine with Chrome already running). - return static_cast<ChromeFrame*>(win_util::GetWindowUserData(hwnd)); + return static_cast<BrowserWindow*>(win_util::GetWindowUserData(hwnd)); } } return NULL; } // static -ChromeFrame* ChromeFrame::CreateChromeFrame(const gfx::Rect& bounds, - Browser* browser) { - ChromeFrame* frame = NULL; +BrowserWindow* FrameUtil::CreateBrowserWindow(const gfx::Rect& bounds, + Browser* browser) { + BrowserWindow* frame = NULL; switch (browser->GetType()) { case BrowserType::TABBED_BROWSER: { @@ -98,7 +98,7 @@ ChromeFrame* ChromeFrame::CreateChromeFrame(const gfx::Rect& bounds, } // static -bool ChromeFrame::LoadAccelerators(ChromeFrame* frame, +bool FrameUtil::LoadAccelerators(BrowserWindow* frame, HACCEL accelerator_table, ChromeViews::AcceleratorTarget* accelerator_target) { // We have to copy the table to access its contents. @@ -140,18 +140,12 @@ bool ChromeFrame::LoadAccelerators(ChromeFrame* frame, return true; } -void ChromeFrame::InfoBubbleClosing() { - HWND hwnd = static_cast<HWND>(GetPlatformID()); - // The frame is really inactive, send notification now. - DefWindowProc(hwnd, WM_NCACTIVATE, FALSE, 0); -} - // static -bool ChromeFrame::ActivateAppModalDialog(Browser* browser) { +bool FrameUtil::ActivateAppModalDialog(Browser* browser) { // If another browser is app modal, flash and activate the modal browser. if (BrowserList::IsShowingAppModalDialog()) { if (browser != BrowserList::GetLastActive()) { - BrowserList::GetLastActive()->frame()->FlashFrame(); + BrowserList::GetLastActive()->window()->FlashFrame(); BrowserList::GetLastActive()->MoveToFront(true); } AppModalDialogQueue::ActivateModalDialog(); @@ -161,7 +155,7 @@ bool ChromeFrame::ActivateAppModalDialog(Browser* browser) { } // static -void ChromeFrame::EndSession() { +void FrameUtil::EndSession() { // EndSession is invoked once per frame. Only do something the first time. static bool already_ended = false; if (already_ended) @@ -191,7 +185,8 @@ void ChromeFrame::EndSession() { } -void ChromeFrame::NotifyTabsOfThemeChange(Browser* browser) { +// static +void FrameUtil::NotifyTabsOfThemeChange(Browser* browser) { if (!browser) { NOTREACHED(); return; diff --git a/chrome/browser/frame_util.h b/chrome/browser/frame_util.h new file mode 100644 index 0000000..7b0e2be --- /dev/null +++ b/chrome/browser/frame_util.h @@ -0,0 +1,76 @@ +// Copyright 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef CHROME_BROWSER_FRAME_UTIL_H_ +#define CHROME_BROWSER_FRAME_UTIL_H_ + +#include <windows.h> + +class Browser; +class BrowserWindow; +namespace ChromeViews { +class AcceleratorTarget; +} +namespace gfx { +class Rect; +} + +// Static helpers for frames. Basically shared code until Magic Browzr lands. +class FrameUtil { + public: + // Mark the frame such as it can be retrieved using GetChromeFrameForWindow() + static void RegisterBrowserWindow(BrowserWindow* frame); + + // Return a ChromeFrame instance given an hwnd. + static BrowserWindow* GetBrowserWindowForHWND(HWND hwnd); + + // Create a ChromeFrame for the given browser. + static BrowserWindow* CreateBrowserWindow(const gfx::Rect& bounds, + Browser* browser); + + // Initialize the accelerators for that frame. + static bool LoadAccelerators( + BrowserWindow* frame, + HACCEL accelerator_table, + ChromeViews::AcceleratorTarget* accelerator_target); + + // Activate any app modal dialog that might be present. Returns true if one + // was present. + static bool ActivateAppModalDialog(Browser* browser); + + // Invoked when windows is shutting down (or the user is logging off). When + // this method returns windows is going to kill our process. As such, this + // blocks until the shut-down has been marked as clean. + static void EndSession(); + + // Notifies all tabs with associated WebContents of theme changes. + static void NotifyTabsOfThemeChange(Browser* browser); +}; + +#endif // #ifndef CHROME_BROWSER_FRAME_UTIL_H__ diff --git a/chrome/browser/frame_view.cc b/chrome/browser/frame_view.cc index b6de86c..cb6d7bc 100644 --- a/chrome/browser/frame_view.cc +++ b/chrome/browser/frame_view.cc @@ -29,12 +29,12 @@ #include "chrome/browser/frame_view.h" -#include "chrome/browser/chrome_frame.h" +#include "chrome/browser/browser_window.h" #include "chrome/browser/tabs/tab_strip.h" #include "chrome/common/os_exchange_data.h" -FrameView::FrameView(ChromeFrame* frame) - : frame_(frame), +FrameView::FrameView(BrowserWindow* window) + : window_(window), can_drop_(false), forwarding_to_tab_strip_(false) { } @@ -44,8 +44,8 @@ void FrameView::AddViewToDropList(ChromeViews::View* view) { } bool FrameView::CanDrop(const OSExchangeData& data) { - can_drop_ = (frame_->GetTabStrip()->IsVisible() && - !frame_->GetTabStrip()->IsAnimating() && + can_drop_ = (window_->GetTabStrip()->IsVisible() && + !window_->GetTabStrip()->IsAnimating() && data.HasURL()); return can_drop_; } @@ -55,7 +55,7 @@ void FrameView::OnDragEntered(const ChromeViews::DropTargetEvent& event) { forwarding_to_tab_strip_ = true; scoped_ptr<ChromeViews::DropTargetEvent> mapped_event( MapEventToTabStrip(event)); - frame_->GetTabStrip()->OnDragEntered(*mapped_event.get()); + window_->GetTabStrip()->OnDragEntered(*mapped_event.get()); } } @@ -65,13 +65,13 @@ int FrameView::OnDragUpdated(const ChromeViews::DropTargetEvent& event) { scoped_ptr<ChromeViews::DropTargetEvent> mapped_event( MapEventToTabStrip(event)); if (!forwarding_to_tab_strip_) { - frame_->GetTabStrip()->OnDragEntered(*mapped_event.get()); + window_->GetTabStrip()->OnDragEntered(*mapped_event.get()); forwarding_to_tab_strip_ = true; } - return frame_->GetTabStrip()->OnDragUpdated(*mapped_event.get()); + return window_->GetTabStrip()->OnDragUpdated(*mapped_event.get()); } else if (forwarding_to_tab_strip_) { forwarding_to_tab_strip_ = false; - frame_->GetTabStrip()->OnDragExited(); + window_->GetTabStrip()->OnDragExited(); } } return DragDropTypes::DRAG_NONE; @@ -80,7 +80,7 @@ int FrameView::OnDragUpdated(const ChromeViews::DropTargetEvent& event) { void FrameView::OnDragExited() { if (forwarding_to_tab_strip_) { forwarding_to_tab_strip_ = false; - frame_->GetTabStrip()->OnDragExited(); + window_->GetTabStrip()->OnDragExited(); } } @@ -89,18 +89,18 @@ int FrameView::OnPerformDrop(const ChromeViews::DropTargetEvent& event) { forwarding_to_tab_strip_ = false; scoped_ptr<ChromeViews::DropTargetEvent> mapped_event( MapEventToTabStrip(event)); - return frame_->GetTabStrip()->OnPerformDrop(*mapped_event.get()); + return window_->GetTabStrip()->OnPerformDrop(*mapped_event.get()); } return DragDropTypes::DRAG_NONE; } bool FrameView::ShouldForwardToTabStrip( const ChromeViews::DropTargetEvent& event) { - if (!frame_->GetTabStrip()->IsVisible()) + if (!window_->GetTabStrip()->IsVisible()) return false; - const int tab_y = frame_->GetTabStrip()->GetY(); - const int tab_height = frame_->GetTabStrip()->GetHeight(); + const int tab_y = window_->GetTabStrip()->GetY(); + const int tab_height = window_->GetTabStrip()->GetHeight(); if (event.GetY() >= tab_y + tab_height) return false; @@ -113,7 +113,7 @@ bool FrameView::ShouldForwardToTabStrip( ChromeViews::View* view_over_mouse = GetViewForPoint(CPoint(event.GetX(), event.GetY())); return (view_over_mouse == this || - view_over_mouse == frame_->GetTabStrip() || + view_over_mouse == window_->GetTabStrip() || dropable_views_.find(view_over_mouse) != dropable_views_.end()); } @@ -125,7 +125,7 @@ void FrameView::ViewHierarchyChanged(bool is_add, View* parent, View* child) { ChromeViews::DropTargetEvent* FrameView::MapEventToTabStrip( const ChromeViews::DropTargetEvent& event) { gfx::Point tab_strip_loc(event.location()); - ConvertPointToView(this, frame_->GetTabStrip(), &tab_strip_loc); + ConvertPointToView(this, window_->GetTabStrip(), &tab_strip_loc); return new ChromeViews::DropTargetEvent(event.GetData(), tab_strip_loc.x(), tab_strip_loc.y(), event.GetSourceOperations()); diff --git a/chrome/browser/frame_view.h b/chrome/browser/frame_view.h index 2ea2c47..18f0b73 100644 --- a/chrome/browser/frame_view.h +++ b/chrome/browser/frame_view.h @@ -34,15 +34,15 @@ #include "chrome/views/view.h" -class ChromeFrame; +class BrowserWindow; class OSExchangeData; -// FrameView is the View that contains all the views of the ChromeFrame +// FrameView is the View that contains all the views of the BrowserWindow // (XPFrame or VistaFrame). FrameView forwards all drag and drop messages to // the TabStrip. class FrameView : public ChromeViews::View { public: - explicit FrameView(ChromeFrame* frame); + explicit FrameView(BrowserWindow* frame); virtual ~FrameView() {} // Adds view to the set of views that drops are allowed to occur on. You only @@ -74,8 +74,8 @@ class FrameView : public ChromeViews::View { ChromeViews::DropTargetEvent* MapEventToTabStrip( const ChromeViews::DropTargetEvent& event); - // The ChromeFrame we're the child of. - ChromeFrame* frame_; + // The BrowserWindow we're the child of. + BrowserWindow* window_; // Initially set in CanDrop by invoking the same method on the TabStrip. bool can_drop_; diff --git a/chrome/browser/session_service.cc b/chrome/browser/session_service.cc index f657f91..e90f8b8 100644 --- a/chrome/browser/session_service.cc +++ b/chrome/browser/session_service.cc @@ -38,7 +38,7 @@ #include "base/thread.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/chrome_frame.h" +#include "chrome/browser/browser_window.h" #include "chrome/browser/navigation_controller.h" #include "chrome/browser/navigation_entry.h" #include "chrome/browser/profile.h" @@ -896,8 +896,8 @@ void SessionService::BuildCommandsForBrowser( commands->push_back( CreateSetWindowBoundsCommand(browser->session_id(), - browser->frame()->GetNormalBounds(), - browser->frame()->IsMaximized())); + browser->window()->GetNormalBounds(), + browser->window()->IsMaximized())); commands->push_back(CreateSetWindowTypeCommand( browser->session_id(), browser->GetType())); diff --git a/chrome/browser/tabs/dragged_tab_controller.cc b/chrome/browser/tabs/dragged_tab_controller.cc index 0a337df..0e7ac34 100644 --- a/chrome/browser/tabs/dragged_tab_controller.cc +++ b/chrome/browser/tabs/dragged_tab_controller.cc @@ -31,7 +31,8 @@ #include "chrome/browser/tabs/dragged_tab_controller.h" -#include "chrome/browser/chrome_frame.h" +#include "chrome/browser/browser_window.h" +#include "chrome/browser/frame_util.h" #include "chrome/browser/tab_contents.h" #include "chrome/browser/tabs/dragged_tab_view.h" #include "chrome/browser/tabs/hwnd_photobooth.h" @@ -418,7 +419,7 @@ TabStrip* DraggedTabController::GetTabStripForPoint( if (!other_hwnd) return NULL; - ChromeFrame* other_frame = ChromeFrame::GetChromeFrameForWindow(other_hwnd); + BrowserWindow* other_frame = FrameUtil::GetBrowserWindowForHWND(other_hwnd); if (other_frame) { TabStrip* other_tabstrip = other_frame->GetTabStrip(); if (!other_tabstrip->IsCompatibleWith(source_tabstrip_)) diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc index 9f505ed..e9dbb11 100644 --- a/chrome/browser/views/bookmark_bar_view.cc +++ b/chrome/browser/views/bookmark_bar_view.cc @@ -37,7 +37,7 @@ #include "chrome/browser/browser.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/chrome_frame.h" +#include "chrome/browser/browser_window.h" #include "chrome/browser/drag_utils.h" #include "chrome/browser/download_util.h" #include "chrome/browser/history/history_backend.h" @@ -413,6 +413,10 @@ class EditFolderController : public InputWindowDelegate, l10n_util::GetString(IDS_BOOMARK_FOLDER_EDITOR_WINDOW_TITLE); } + virtual ChromeViews::View* GetContentsView() { + return view_; + } + BookmarkBarView* view_; // If is_new is true, this is the parent to create the new node under. @@ -1719,7 +1723,7 @@ void BookmarkBarView::RunMenu(ChromeViews::View* view, View::ConvertPointToScreen(this, &screen_loc); menu_runner_.reset(new MenuRunner(this, node, start_index)); HWND parent_hwnd = reinterpret_cast<HWND>( - browser_->frame()->GetPlatformID()); + browser_->window()->GetPlatformID()); menu_runner_->RunMenuAt(parent_hwnd, gfx::Rect(screen_loc.x, screen_loc.y, view->GetWidth(), height), diff --git a/chrome/browser/views/first_run_bubble.cc b/chrome/browser/views/first_run_bubble.cc index 86f9fb1..f17071c 100644 --- a/chrome/browser/views/first_run_bubble.cc +++ b/chrome/browser/views/first_run_bubble.cc @@ -32,7 +32,7 @@ #include "chrome/app/locales/locale_settings.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_list.h" -#include "chrome/browser/chrome_frame.h" +#include "chrome/browser/browser_window.h" #include "chrome/browser/options_window.h" #include "chrome/browser/standard_layout.h" #include "chrome/browser/template_url_model.h" @@ -229,7 +229,7 @@ FirstRunBubble* FirstRunBubble::Show(HWND parent_hwnd, ChromeViews::View* view = new FirstRunBubbleView(window); window->SetDelegate(window); window->Init(parent_hwnd, position_relative_to, view); - ChromeFrame* frame = window->GetHostingFrame(); + BrowserWindow* frame = window->GetHostingWindow(); DCHECK(frame); frame->InfoBubbleShowing(); window->ShowWindow(SW_SHOW); diff --git a/chrome/browser/views/info_bubble.cc b/chrome/browser/views/info_bubble.cc index f239684..b307a98 100644 --- a/chrome/browser/views/info_bubble.cc +++ b/chrome/browser/views/info_bubble.cc @@ -31,7 +31,8 @@ #include "base/win_util.h" #include "chrome/app/theme/theme_resources.h" -#include "chrome/browser/chrome_frame.h" +#include "chrome/browser/browser_window.h" +#include "chrome/browser/frame_util.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/gfx/path.h" #include "chrome/common/resource_bundle.h" @@ -95,7 +96,7 @@ InfoBubble* InfoBubble::Show(HWND parent_hwnd, InfoBubbleDelegate* delegate) { InfoBubble* window = new InfoBubble(); window->Init(parent_hwnd, position_relative_to, content); - ChromeFrame* frame = window->GetHostingFrame(); + BrowserWindow* frame = window->GetHostingWindow(); if (frame) frame->InfoBubbleShowing(); window->ShowWindow(SW_SHOW); @@ -164,7 +165,7 @@ void InfoBubble::Init(HWND parent_hwnd, void InfoBubble::Close() { // We don't fade out because it looks terrible. - ChromeFrame* frame = GetHostingFrame(); + BrowserWindow* frame = GetHostingWindow(); if (delegate_) delegate_->InfoBubbleClosing(this); if (frame) @@ -212,9 +213,9 @@ InfoBubble::ContentView* InfoBubble::CreateContentView(View* content) { return new ContentView(content, this); } -ChromeFrame* InfoBubble::GetHostingFrame() { +BrowserWindow* InfoBubble::GetHostingWindow() { HWND owning_frame_hwnd = GetAncestor(GetHWND(), GA_ROOTOWNER); - ChromeFrame* frame = ChromeFrame::GetChromeFrameForWindow(owning_frame_hwnd); + BrowserWindow* frame = FrameUtil::GetBrowserWindowForHWND(owning_frame_hwnd); if (!frame) { // We should always have a frame, but there was a bug else where that // made it possible for the frame to be NULL, so we have the check. If diff --git a/chrome/browser/views/info_bubble.h b/chrome/browser/views/info_bubble.h index ee4a2b3..8678428 100644 --- a/chrome/browser/views/info_bubble.h +++ b/chrome/browser/views/info_bubble.h @@ -42,7 +42,7 @@ // (or rather ContentView) insets the content view for you, so that the // content typically shouldn't have any additional margins around the view. -class ChromeFrame; +class BrowserWindow; class InfoBubble; class InfoBubbleDelegate { @@ -174,8 +174,8 @@ class InfoBubble : public ChromeViews::HWNDViewContainer, // Creates and return a new ContentView containing content. virtual ContentView* CreateContentView(ChromeViews::View* content); - // Returns the ChromeFrame that owns this InfoBubble. - ChromeFrame* GetHostingFrame(); + // Returns the BrowserWindow that owns this InfoBubble. + BrowserWindow* GetHostingWindow(); private: // The delegate notified when the InfoBubble is closed. diff --git a/chrome/browser/views/toolbar_star_toggle.cc b/chrome/browser/views/toolbar_star_toggle.cc index 36a4bb2..51f56ed 100644 --- a/chrome/browser/views/toolbar_star_toggle.cc +++ b/chrome/browser/views/toolbar_star_toggle.cc @@ -32,7 +32,6 @@ #include "chrome/app/theme/theme_resources.h" #include "chrome/browser/bookmark_bar_model.h" #include "chrome/browser/browser.h" -#include "chrome/browser/chrome_frame.h" #include "chrome/browser/views/bookmark_bubble_view.h" #include "chrome/browser/views/toolbar_view.h" #include "chrome/common/resource_bundle.h" diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index 7b673a3..5ac0bc3 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -38,7 +38,6 @@ #include "chrome/browser/browser.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/character_encoding.h" -#include "chrome/browser/chrome_frame.h" #include "chrome/browser/drag_utils.h" #include "chrome/browser/navigation_controller.h" #include "chrome/browser/navigation_entry.h" diff --git a/chrome/browser/vista_frame.cc b/chrome/browser/vista_frame.cc index c804400..e437d33 100644 --- a/chrome/browser/vista_frame.cc +++ b/chrome/browser/vista_frame.cc @@ -42,6 +42,7 @@ #include "chrome/app/theme/theme_resources.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_list.h" +#include "chrome/browser/frame_util.h" #include "chrome/browser/suspend_controller.h" #include "chrome/browser/tab_contents.h" #include "chrome/browser/tab_contents_container_view.h" @@ -386,12 +387,12 @@ void VistaFrame::Layout() { //////////////////////////////////////////////////////////////////////////////// // -// ChromeFrame implementation +// BrowserWindow implementation // //////////////////////////////////////////////////////////////////////////////// void VistaFrame::Init() { - ChromeFrame::RegisterChromeFrame(this); + FrameUtil::RegisterBrowserWindow(this); // Link the HWND with its root view so we can retrieve the RootView from the // HWND for automation purposes. @@ -456,7 +457,7 @@ void VistaFrame::Init() { // Register accelerators. HACCEL accelerators_table = AtlLoadAccelerators(IDR_MAINFRAME); DCHECK(accelerators_table); - ChromeFrame::LoadAccelerators(this, accelerators_table, this); + FrameUtil::LoadAccelerators(this, accelerators_table, this); ShelfVisibilityChanged(); root_view_.OnViewContainerCreated(); @@ -482,7 +483,7 @@ void VistaFrame::BrowserDidPaint(HRGN region) { // not pump the final messages. void VistaFrame::OnEndSession(BOOL ending, UINT logoff) { tabstrip_->AbortActiveDragSession(); - EndSession(); + FrameUtil::EndSession(); } // Note: called directly by the handler macros to handle WM_CLOSE messages. @@ -656,7 +657,7 @@ BOOL VistaFrame::OnPowerBroadcast(DWORD power_event, DWORD data) { void VistaFrame::OnThemeChanged() { // Notify NativeTheme. gfx::NativeTheme::instance()->CloseHandles(); - ChromeFrame::NotifyTabsOfThemeChange(browser_); + FrameUtil::NotifyTabsOfThemeChange(browser_); } void VistaFrame::OnMouseButtonDown(UINT flags, const CPoint& pt) { @@ -1000,7 +1001,7 @@ LRESULT VistaFrame::OnNCHitTest(const CPoint& pt) { } void VistaFrame::OnActivate(UINT n_state, BOOL is_minimized, HWND other) { - if (ActivateAppModalDialog(browser_)) + if (FrameUtil::ActivateAppModalDialog(browser_)) return; // Enable our custom window if we haven't already (this works in combination @@ -1029,7 +1030,8 @@ void VistaFrame::OnActivate(UINT n_state, BOOL is_minimized, HWND other) { int VistaFrame::OnMouseActivate(CWindow wndTopLevel, UINT nHitTest, UINT message) { - return ActivateAppModalDialog(browser_) ? MA_NOACTIVATEANDEAT : MA_ACTIVATE; + return FrameUtil::ActivateAppModalDialog(browser_) ? MA_NOACTIVATEANDEAT + : MA_ACTIVATE; } void VistaFrame::OnPaint(HDC dc) { diff --git a/chrome/browser/vista_frame.h b/chrome/browser/vista_frame.h index cbd5ee0..e9e1d0a 100644 --- a/chrome/browser/vista_frame.h +++ b/chrome/browser/vista_frame.h @@ -38,7 +38,7 @@ #include "base/message_loop.h" #include "chrome/app/chrome_dll_resource.h" -#include "chrome/browser/chrome_frame.h" +#include "chrome/browser/browser_window.h" #include "chrome/browser/frame_view.h" #include "chrome/browser/views/status_bubble.h" #include "chrome/views/view_container.h" @@ -62,7 +62,7 @@ class TabStrip; // A CWindowImpl subclass that implements our main frame on Windows Vista // //////////////////////////////////////////////////////////////////////////////// -class VistaFrame : public ChromeFrame, +class VistaFrame : public BrowserWindow, public CWindowImpl<VistaFrame, CWindow, CWinTraits<WS_OVERLAPPEDWINDOW | @@ -179,7 +179,7 @@ class VistaFrame : public ChromeFrame, void OnThemeChanged(); //////////////////////////////////////////////////////////////////////////////// - // ChromeFrame implementation + // BrowserWindow implementation //////////////////////////////////////////////////////////////////////////////// virtual void Init(); diff --git a/chrome/browser/window_sizer.cc b/chrome/browser/window_sizer.cc index b654e4c..0809810 100644 --- a/chrome/browser/window_sizer.cc +++ b/chrome/browser/window_sizer.cc @@ -33,7 +33,7 @@ #include "chrome/browser/browser_list.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_type.h" -#include "chrome/browser/chrome_frame.h" +#include "chrome/browser/browser_window.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" @@ -167,7 +167,7 @@ class DefaultStateProvider : public WindowSizer::StateProvider { Browser* last_active = *it; if (last_active && last_active->GetType() == BrowserType::TABBED_BROWSER) { - ChromeFrame* frame = last_active->frame(); + BrowserWindow* frame = last_active->window(); DCHECK(frame); *bounds = frame->GetNormalBounds(); return true; diff --git a/chrome/browser/xp_frame.cc b/chrome/browser/xp_frame.cc index e4bcc7e..d3f57f2 100644 --- a/chrome/browser/xp_frame.cc +++ b/chrome/browser/xp_frame.cc @@ -36,7 +36,7 @@ #include "chrome/app/theme/theme_resources.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_list.h" -#include "chrome/browser/chrome_frame.h" +#include "chrome/browser/frame_util.h" #include "chrome/browser/point_buffer.h" #include "chrome/browser/suspend_controller.h" #include "chrome/browser/tab_contents.h" @@ -412,7 +412,7 @@ void XPFrame::InitializeIfNeeded() { void XPFrame::Init() { ResourceBundle &rb = ResourceBundle::GetSharedInstance(); - ChromeFrame::RegisterChromeFrame(this); + FrameUtil::RegisterBrowserWindow(this); // Link the HWND with its root view so we can retrieve the RootView from the // HWND for automation purposes. @@ -539,7 +539,7 @@ void XPFrame::Init() { // Register accelerators. HACCEL accelerators_table = AtlLoadAccelerators(IDR_MAINFRAME); DCHECK(accelerators_table); - ChromeFrame::LoadAccelerators(this, accelerators_table, this); + FrameUtil::LoadAccelerators(this, accelerators_table, this); ShelfVisibilityChanged(); root_view_.OnViewContainerCreated(); @@ -820,7 +820,7 @@ void XPFrame::Layout() { // the application or we are going to be flagged as flaky. void XPFrame::OnEndSession(BOOL ending, UINT logoff) { tabstrip_->AbortActiveDragSession(); - EndSession(); + FrameUtil::EndSession(); } // Note: called directly by the handler macros to handle WM_CLOSE messages. @@ -1227,7 +1227,7 @@ void XPFrame::OnKeyUp(TCHAR c, UINT rep_cnt, UINT flags) { } void XPFrame::OnActivate(UINT n_state, BOOL is_minimized, HWND other) { - if (ActivateAppModalDialog(browser_)) + if (FrameUtil::ActivateAppModalDialog(browser_)) return; // We get deactivation notices before the window is deactivated, @@ -1248,7 +1248,8 @@ void XPFrame::OnActivate(UINT n_state, BOOL is_minimized, HWND other) { } int XPFrame::OnMouseActivate(CWindow wndTopLevel, UINT nHitTest, UINT message) { - return ActivateAppModalDialog(browser_) ? MA_NOACTIVATEANDEAT : MA_ACTIVATE; + return FrameUtil::ActivateAppModalDialog(browser_) ? MA_NOACTIVATEANDEAT + : MA_ACTIVATE; } void XPFrame::OnPaint(HDC dc) { @@ -1492,7 +1493,7 @@ BOOL XPFrame::OnPowerBroadcast(DWORD power_event, DWORD data) { void XPFrame::OnThemeChanged() { // Notify NativeTheme. gfx::NativeTheme::instance()->CloseHandles(); - ChromeFrame::NotifyTabsOfThemeChange(browser_); + FrameUtil::NotifyTabsOfThemeChange(browser_); } LRESULT XPFrame::OnAppCommand( @@ -1838,7 +1839,7 @@ void XPFrame::InfoBubbleShowing() { void XPFrame::InfoBubbleClosing() { paint_as_active_ = false; - ChromeFrame::InfoBubbleClosing(); + BrowserWindow::InfoBubbleClosing(); // How we render the frame has changed, we need to force a paint otherwise // visually the user won't be able to tell. InvalidateRect(NULL, false); diff --git a/chrome/browser/xp_frame.h b/chrome/browser/xp_frame.h index 06ac2e3..a3fa706 100644 --- a/chrome/browser/xp_frame.h +++ b/chrome/browser/xp_frame.h @@ -38,7 +38,7 @@ #include "base/message_loop.h" #include "chrome/app/chrome_dll_resource.h" -#include "chrome/browser/chrome_frame.h" +#include "chrome/browser/browser_window.h" #include "chrome/browser/frame_view.h" #include "chrome/browser/views/status_bubble.h" #include "chrome/views/view_container.h" @@ -65,7 +65,7 @@ class TemporaryPlaceholder; // a ChromeView hierarchy for the tabs and toolbar // //////////////////////////////////////////////////////////////////////////////// -class XPFrame : public ChromeFrame, +class XPFrame : public BrowserWindow, public CWindowImpl<XPFrame, CWindow, CWinTraits<WS_SYSMENU | @@ -91,7 +91,7 @@ class XPFrame : public ChromeFrame, bool is_off_the_record); //////////////////////////////////////////////////////////////////////////////// - // ChromeFrame implementation + // BrowserWindow implementation //////////////////////////////////////////////////////////////////////////////// virtual ~XPFrame(); virtual void Init(); |