diff options
author | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-07-30 04:12:18 +0000 |
---|---|---|
committer | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-07-30 04:12:18 +0000 |
commit | 0f2f4b60511540e292e085ba5e1985be6bf93908 (patch) | |
tree | 6d6bb042fe78bb23c4eca3cf4a4222a3dab38e74 /chrome/browser/task_manager.cc | |
parent | aaeb9dc745d49afa66c1b613daa5a3123f309955 (diff) | |
download | chromium_src-0f2f4b60511540e292e085ba5e1985be6bf93908.zip chromium_src-0f2f4b60511540e292e085ba5e1985be6bf93908.tar.gz chromium_src-0f2f4b60511540e292e085ba5e1985be6bf93908.tar.bz2 |
Window Delegate Improvements:
- Windows now must have a Delegate. Just construct the default WindowDelegate
if
you don't want to have to write one in testing.
- Windows now obtain their contents view by asking the delegate via
WindowDelegate::GetContentsView.
- Contents views no longer need to manually store a pointer to the Window that
contains them, WindowDelegate does this automatically via its window()
accessor.
Reviewer notes:
- review window_delegate.h first, then
- window.h/cc
- custom frame window.h/cc
- constrained_window_impl.h/cc
- then everything else (just updating all call sites)
B=1280060
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/task_manager.cc')
-rw-r--r-- | chrome/browser/task_manager.cc | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/chrome/browser/task_manager.cc b/chrome/browser/task_manager.cc index 26731c9..17cddba 100644 --- a/chrome/browser/task_manager.cc +++ b/chrome/browser/task_manager.cc @@ -823,7 +823,7 @@ void TaskManager::RegisterPrefs(PrefService* prefs) { prefs->RegisterDictionaryPref(prefs::kTaskManagerWindowPlacement); } -TaskManager::TaskManager() : window_(NULL) { +TaskManager::TaskManager() { table_model_ = new TaskManagerTableModel(this); contents_.reset(new TaskManagerContents(this, table_model_)); } @@ -834,19 +834,16 @@ TaskManager::~TaskManager() { // static void TaskManager::Open() { TaskManager* task_manager = GetInstance(); - if (task_manager->window_) { - task_manager->window_->MoveToFront(true); + if (task_manager->window()) { + task_manager->window()->MoveToFront(true); } else { - task_manager->window_ = - ChromeViews::Window::CreateChromeWindow( - NULL, gfx::Rect(), task_manager->contents_.get(), task_manager); + ChromeViews::Window::CreateChromeWindow(NULL, gfx::Rect(), task_manager); task_manager->table_model_->StartUpdating(); - task_manager->window_->Show(); + task_manager->window()->Show(); } } void TaskManager::Close() { - window_ = NULL; table_model_->StopUpdating(); table_model_->Clear(); } @@ -923,15 +920,15 @@ std::wstring TaskManager::GetWindowTitle() const { void TaskManager::SaveWindowPosition(const CRect& bounds, bool maximized, bool always_on_top) { - window_->SaveWindowPositionToPrefService(g_browser_process->local_state(), - prefs::kTaskManagerWindowPlacement, - bounds, maximized, always_on_top); + window()->SaveWindowPositionToPrefService(g_browser_process->local_state(), + prefs::kTaskManagerWindowPlacement, + bounds, maximized, always_on_top); } bool TaskManager::RestoreWindowPosition(CRect* bounds, bool* maximized, bool* always_on_top) { - return window_->RestoreWindowPositionFromPrefService( + return window()->RestoreWindowPositionFromPrefService( g_browser_process->local_state(), prefs::kTaskManagerWindowPlacement, bounds, maximized, always_on_top); @@ -949,6 +946,10 @@ void TaskManager::WindowClosing() { Close(); } +ChromeViews::View* TaskManager::GetContentsView() { + return contents_.get(); +} + // static TaskManager* TaskManager::GetInstance() { return Singleton<TaskManager>::get(); |