diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-22 20:28:00 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-22 20:28:00 +0000 |
commit | bca14bc4a3d8d82e817f01d0bb105aaa6e3c081a (patch) | |
tree | 70e34ef2265cb64373290c2b745cfb36e2b0ffda | |
parent | b69aaa3563503d5ce21f2d7b6308f89adb135694 (diff) | |
download | chromium_src-bca14bc4a3d8d82e817f01d0bb105aaa6e3c081a.zip chromium_src-bca14bc4a3d8d82e817f01d0bb105aaa6e3c081a.tar.gz chromium_src-bca14bc4a3d8d82e817f01d0bb105aaa6e3c081a.tar.bz2 |
Out of line cleanups for Mac.
BUG=none
TEST=compiles
Review URL: http://codereview.chromium.org/6542027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75626 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | app/surface/accelerated_surface_mac.cc | 2 | ||||
-rw-r--r-- | app/surface/accelerated_surface_mac.h | 2 | ||||
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit_view_mac.h | 4 | ||||
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit_view_mac.mm | 8 | ||||
-rw-r--r-- | chrome/browser/mach_broker_mac.cc | 2 | ||||
-rw-r--r-- | chrome/browser/mach_broker_mac.h | 1 | ||||
-rw-r--r-- | chrome/browser/password_manager/password_store_mac.h | 24 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/bookmarks/bookmark_model_observer_for_cocoa.h | 42 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/bookmarks/bookmark_model_observer_for_cocoa.mm | 64 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/constrained_window_mac.h | 36 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/constrained_window_mac.mm | 44 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/rwhvm_editcommand_helper.h | 1 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/rwhvm_editcommand_helper.mm | 2 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/table_row_nsimage_cache.h | 1 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/table_row_nsimage_cache.mm | 2 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 1 |
16 files changed, 160 insertions, 76 deletions
diff --git a/app/surface/accelerated_surface_mac.cc b/app/surface/accelerated_surface_mac.cc index 0060fda..ab5529e 100644 --- a/app/surface/accelerated_surface_mac.cc +++ b/app/surface/accelerated_surface_mac.cc @@ -19,6 +19,8 @@ AcceleratedSurface::AcceleratedSurface() depth_stencil_renderbuffer_(0) { } +AcceleratedSurface::~AcceleratedSurface() {} + bool AcceleratedSurface::Initialize(gfx::GLContext* share_context, bool allocate_fbo) { allocate_fbo_ = allocate_fbo; diff --git a/app/surface/accelerated_surface_mac.h b/app/surface/accelerated_surface_mac.h index 60f9a46..8f7aaf0 100644 --- a/app/surface/accelerated_surface_mac.h +++ b/app/surface/accelerated_surface_mac.h @@ -34,7 +34,7 @@ class Rect; class AcceleratedSurface { public: AcceleratedSurface(); - virtual ~AcceleratedSurface() { } + virtual ~AcceleratedSurface(); // Set up internal buffers. |share_context|, if non-NULL, is a context // with which the internally created OpenGL context shares textures and diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.h b/chrome/browser/autocomplete/autocomplete_edit_view_mac.h index 3ba5963..e77cbc2 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.h +++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.h @@ -35,8 +35,8 @@ class AutocompleteEditViewMac : public AutocompleteEditView, virtual ~AutocompleteEditViewMac(); // Implement the AutocompleteEditView interface. - virtual AutocompleteEditModel* model() { return model_.get(); } - virtual const AutocompleteEditModel* model() const { return model_.get(); } + virtual AutocompleteEditModel* model(); + virtual const AutocompleteEditModel* model() const; virtual void SaveStateToTab(TabContents* tab); virtual void Update(const TabContents* tab_for_state_restoring); diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm index 4030342..9af6904 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm +++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm @@ -207,6 +207,14 @@ AutocompleteEditViewMac::~AutocompleteEditViewMac() { [field_ setObserver:NULL]; } +AutocompleteEditModel* AutocompleteEditViewMac::model() { + return model_.get(); +} + +const AutocompleteEditModel* AutocompleteEditViewMac::model() const { + return model_.get(); +} + void AutocompleteEditViewMac::SaveStateToTab(TabContents* tab) { DCHECK(tab); diff --git a/chrome/browser/mach_broker_mac.cc b/chrome/browser/mach_broker_mac.cc index 03932ad..6eeccb2 100644 --- a/chrome/browser/mach_broker_mac.cc +++ b/chrome/browser/mach_broker_mac.cc @@ -128,6 +128,8 @@ MachBroker* MachBroker::GetInstance() { MachBroker::MachBroker() : listener_thread_started_(false) { } +MachBroker::~MachBroker() {} + void MachBroker::PrepareForFork() { if (!listener_thread_started_) { listener_thread_started_ = true; diff --git a/chrome/browser/mach_broker_mac.h b/chrome/browser/mach_broker_mac.h index 0d4baa8..87107b5 100644 --- a/chrome/browser/mach_broker_mac.h +++ b/chrome/browser/mach_broker_mac.h @@ -86,6 +86,7 @@ class MachBroker : public base::ProcessMetrics::PortProvider, private: // Private constructor. MachBroker(); + ~MachBroker(); // True if the listener thread has been started. bool listener_thread_started_; diff --git a/chrome/browser/password_manager/password_store_mac.h b/chrome/browser/password_manager/password_store_mac.h index 371fd21..5cd3436 100644 --- a/chrome/browser/password_manager/password_store_mac.h +++ b/chrome/browser/password_manager/password_store_mac.h @@ -37,19 +37,19 @@ class PasswordStoreMac : public PasswordStore { virtual void ScheduleTask(Task* task); private: - void ReportMetricsImpl(); - void AddLoginImpl(const webkit_glue::PasswordForm& form); - void UpdateLoginImpl(const webkit_glue::PasswordForm& form); - void RemoveLoginImpl(const webkit_glue::PasswordForm& form); - void RemoveLoginsCreatedBetweenImpl(const base::Time& delete_begin, - const base::Time& delete_end); - void GetLoginsImpl(GetLoginsRequest* request, - const webkit_glue::PasswordForm& form); - void GetAutofillableLoginsImpl(GetLoginsRequest* request); - void GetBlacklistLoginsImpl(GetLoginsRequest* request); - bool FillAutofillableLogins( + virtual void ReportMetricsImpl(); + virtual void AddLoginImpl(const webkit_glue::PasswordForm& form); + virtual void UpdateLoginImpl(const webkit_glue::PasswordForm& form); + virtual void RemoveLoginImpl(const webkit_glue::PasswordForm& form); + virtual void RemoveLoginsCreatedBetweenImpl(const base::Time& delete_begin, + const base::Time& delete_end); + virtual void GetLoginsImpl(GetLoginsRequest* request, + const webkit_glue::PasswordForm& form); + virtual void GetAutofillableLoginsImpl(GetLoginsRequest* request); + virtual void GetBlacklistLoginsImpl(GetLoginsRequest* request); + virtual bool FillAutofillableLogins( std::vector<webkit_glue::PasswordForm*>* forms); - bool FillBlacklistLogins( + virtual bool FillBlacklistLogins( std::vector<webkit_glue::PasswordForm*>* forms); // Adds the given form to the Keychain if it's something we want to store diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_model_observer_for_cocoa.h b/chrome/browser/ui/cocoa/bookmarks/bookmark_model_observer_for_cocoa.h index 0a7da34..9061132 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_model_observer_for_cocoa.h +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_model_observer_for_cocoa.h @@ -41,46 +41,22 @@ class BookmarkModelObserverForCocoa : public BookmarkModelObserver { BookmarkModelObserverForCocoa(const BookmarkNode* node, BookmarkModel* model, NSObject* object, - SEL selector) { - DCHECK(model); - node_ = node; - model_ = model; - object_ = object; - selector_ = selector; - model_->AddObserver(this); - } - virtual ~BookmarkModelObserverForCocoa() { - model_->RemoveObserver(this); - } + SEL selector); + virtual ~BookmarkModelObserverForCocoa(); - virtual void BookmarkModelBeingDeleted(BookmarkModel* model) { - Notify(); - } + virtual void BookmarkModelBeingDeleted(BookmarkModel* model); virtual void BookmarkNodeMoved(BookmarkModel* model, const BookmarkNode* old_parent, int old_index, const BookmarkNode* new_parent, - int new_index) { - // Editors often have a tree of parents, so movement of folders - // must cause a cancel. - Notify(); - } + int new_index); virtual void BookmarkNodeRemoved(BookmarkModel* model, const BookmarkNode* parent, int old_index, - const BookmarkNode* node) { - // See comment in BookmarkNodeMoved. - Notify(); - } + const BookmarkNode* node); virtual void BookmarkNodeChanged(BookmarkModel* model, - const BookmarkNode* node) { - if ((node_ == node) || (!node_)) - Notify(); - } - virtual void BookmarkImportBeginning(BookmarkModel* model) { - // Be conservative. - Notify(); - } + const BookmarkNode* node); + virtual void BookmarkImportBeginning(BookmarkModel* model); // Some notifications we don't care about, but by being pure virtual // in the base class we must implement them. @@ -106,9 +82,7 @@ class BookmarkModelObserverForCocoa : public BookmarkModelObserver { NSObject* object_; // Weak, like a delegate. SEL selector_; - void Notify() { - [object_ performSelector:selector_ withObject:nil]; - } + void Notify(); DISALLOW_COPY_AND_ASSIGN(BookmarkModelObserverForCocoa); }; diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_model_observer_for_cocoa.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_model_observer_for_cocoa.mm new file mode 100644 index 0000000..3345497 --- /dev/null +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_model_observer_for_cocoa.mm @@ -0,0 +1,64 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/cocoa/bookmarks/bookmark_model_observer_for_cocoa.h" + +BookmarkModelObserverForCocoa::BookmarkModelObserverForCocoa( + const BookmarkNode* node, + BookmarkModel* model, + NSObject* object, + SEL selector) { + DCHECK(model); + node_ = node; + model_ = model; + object_ = object; + selector_ = selector; + model_->AddObserver(this); +} + +BookmarkModelObserverForCocoa::~BookmarkModelObserverForCocoa() { + model_->RemoveObserver(this); +} + +void BookmarkModelObserverForCocoa::BookmarkModelBeingDeleted( + BookmarkModel* model) { + Notify(); +} + +void BookmarkModelObserverForCocoa::BookmarkNodeMoved( + BookmarkModel* model, + const BookmarkNode* old_parent, + int old_index, + const BookmarkNode* new_parent, + int new_index) { + // Editors often have a tree of parents, so movement of folders + // must cause a cancel. + Notify(); +} + +void BookmarkModelObserverForCocoa::BookmarkNodeRemoved( + BookmarkModel* model, + const BookmarkNode* parent, + int old_index, + const BookmarkNode* node) { + // See comment in BookmarkNodeMoved. + Notify(); +} + +void BookmarkModelObserverForCocoa::BookmarkNodeChanged( + BookmarkModel* model, + const BookmarkNode* node) { + if ((node_ == node) || (!node_)) + Notify(); +} + +void BookmarkModelObserverForCocoa::BookmarkImportBeginning( + BookmarkModel* model) { + // Be conservative. + Notify(); +} + +void BookmarkModelObserverForCocoa::Notify() { + [object_ performSelector:selector_ withObject:nil]; +} diff --git a/chrome/browser/ui/cocoa/constrained_window_mac.h b/chrome/browser/ui/cocoa/constrained_window_mac.h index 7c056ed..0ebf88b 100644 --- a/chrome/browser/ui/cocoa/constrained_window_mac.h +++ b/chrome/browser/ui/cocoa/constrained_window_mac.h @@ -24,8 +24,8 @@ class TabContents; // directly. class ConstrainedWindowMacDelegate { public: - ConstrainedWindowMacDelegate() : is_sheet_open_(false) { } - virtual ~ConstrainedWindowMacDelegate(); + ConstrainedWindowMacDelegate() : is_sheet_open_(false) {} + virtual ~ConstrainedWindowMacDelegate() {} // Tells the delegate to either delete itself or set up a task to delete // itself later. Note that you MUST close the sheet belonging to your delegate @@ -51,13 +51,11 @@ class ConstrainedWindowMacDelegate { class ConstrainedWindowMacDelegateSystemSheet : public ConstrainedWindowMacDelegate { public: - ConstrainedWindowMacDelegateSystemSheet(id delegate, SEL didEndSelector) - : systemSheet_(nil), - delegate_([delegate retain]), - didEndSelector_(didEndSelector) { } + ConstrainedWindowMacDelegateSystemSheet(id delegate, SEL didEndSelector); + virtual ~ConstrainedWindowMacDelegateSystemSheet(); protected: - void set_sheet(id sheet) { systemSheet_.reset([sheet retain]); } + void set_sheet(id sheet); id sheet() { return systemSheet_; } // Returns an NSArray to be passed as parameters to GTMWindowSheetController. @@ -83,28 +81,14 @@ class ConstrainedWindowMacDelegateSystemSheet class ConstrainedWindowMacDelegateCustomSheet : public ConstrainedWindowMacDelegate { public: - ConstrainedWindowMacDelegateCustomSheet() - : customSheet_(nil), - delegate_(nil), - didEndSelector_(NULL) { } - - ConstrainedWindowMacDelegateCustomSheet(id delegate, SEL didEndSelector) - : customSheet_(nil), - delegate_([delegate retain]), - didEndSelector_(didEndSelector) { } + ConstrainedWindowMacDelegateCustomSheet(); + ConstrainedWindowMacDelegateCustomSheet(id delegate, SEL didEndSelector); + ~ConstrainedWindowMacDelegateCustomSheet(); protected: // For when you need to delay initalization after the constructor call. - void init(NSWindow* sheet, id delegate, SEL didEndSelector) { - DCHECK(!delegate_.get()); - DCHECK(!didEndSelector_); - customSheet_.reset([sheet retain]); - delegate_.reset([delegate retain]); - didEndSelector_ = didEndSelector; - DCHECK(delegate_.get()); - DCHECK(didEndSelector_); - } - void set_sheet(NSWindow* sheet) { customSheet_.reset([sheet retain]); } + void init(NSWindow* sheet, id delegate, SEL didEndSelector); + void set_sheet(NSWindow* sheet); NSWindow* sheet() { return customSheet_; } private: diff --git a/chrome/browser/ui/cocoa/constrained_window_mac.mm b/chrome/browser/ui/cocoa/constrained_window_mac.mm index 9c408a0..c8b9965 100644 --- a/chrome/browser/ui/cocoa/constrained_window_mac.mm +++ b/chrome/browser/ui/cocoa/constrained_window_mac.mm @@ -9,7 +9,18 @@ #import "chrome/browser/ui/cocoa/browser_window_controller.h" #import "third_party/GTM/AppKit/GTMWindowSheetController.h" -ConstrainedWindowMacDelegate::~ConstrainedWindowMacDelegate() {} +ConstrainedWindowMacDelegateSystemSheet:: +ConstrainedWindowMacDelegateSystemSheet(id delegate, SEL didEndSelector) + : systemSheet_(nil), + delegate_([delegate retain]), + didEndSelector_(didEndSelector) {} + +ConstrainedWindowMacDelegateSystemSheet:: + ~ConstrainedWindowMacDelegateSystemSheet() {} + +void ConstrainedWindowMacDelegateSystemSheet::set_sheet(id sheet) { + systemSheet_.reset([sheet retain]); +} NSArray* ConstrainedWindowMacDelegateSystemSheet::GetSheetParameters( id delegate, @@ -31,6 +42,37 @@ void ConstrainedWindowMacDelegateSystemSheet::RunSheet( withParameters:params]; } +ConstrainedWindowMacDelegateCustomSheet:: +ConstrainedWindowMacDelegateCustomSheet() + : customSheet_(nil), + delegate_(nil), + didEndSelector_(NULL) {} + +ConstrainedWindowMacDelegateCustomSheet:: +ConstrainedWindowMacDelegateCustomSheet(id delegate, SEL didEndSelector) + : customSheet_(nil), + delegate_([delegate retain]), + didEndSelector_(didEndSelector) {} + +ConstrainedWindowMacDelegateCustomSheet:: +~ConstrainedWindowMacDelegateCustomSheet() {} + +void ConstrainedWindowMacDelegateCustomSheet::init(NSWindow* sheet, + id delegate, + SEL didEndSelector) { + DCHECK(!delegate_.get()); + DCHECK(!didEndSelector_); + customSheet_.reset([sheet retain]); + delegate_.reset([delegate retain]); + didEndSelector_ = didEndSelector; + DCHECK(delegate_.get()); + DCHECK(didEndSelector_); + } + +void ConstrainedWindowMacDelegateCustomSheet::set_sheet(NSWindow* sheet) { + customSheet_.reset([sheet retain]); +} + void ConstrainedWindowMacDelegateCustomSheet::RunSheet( GTMWindowSheetController* sheetController, NSView* view) { diff --git a/chrome/browser/ui/cocoa/rwhvm_editcommand_helper.h b/chrome/browser/ui/cocoa/rwhvm_editcommand_helper.h index 92935a4..85b572a 100644 --- a/chrome/browser/ui/cocoa/rwhvm_editcommand_helper.h +++ b/chrome/browser/ui/cocoa/rwhvm_editcommand_helper.h @@ -38,6 +38,7 @@ class RWHVMEditCommandHelper { public: RWHVMEditCommandHelper(); + ~RWHVMEditCommandHelper(); // Adds editing selectors to the objc class using the objc runtime APIs. // Each selector is connected to a single c method which forwards the message diff --git a/chrome/browser/ui/cocoa/rwhvm_editcommand_helper.mm b/chrome/browser/ui/cocoa/rwhvm_editcommand_helper.mm index 0aec09e..7f56fe4 100644 --- a/chrome/browser/ui/cocoa/rwhvm_editcommand_helper.mm +++ b/chrome/browser/ui/cocoa/rwhvm_editcommand_helper.mm @@ -179,6 +179,8 @@ RWHVMEditCommandHelper::RWHVMEditCommandHelper() { } } +RWHVMEditCommandHelper::~RWHVMEditCommandHelper() {} + // Dynamically adds Selectors to the aformentioned class. void RWHVMEditCommandHelper::AddEditingSelectorsToClass(Class klass) { for (size_t i = 0; i < arraysize(kEditCommands); ++i) { diff --git a/chrome/browser/ui/cocoa/table_row_nsimage_cache.h b/chrome/browser/ui/cocoa/table_row_nsimage_cache.h index c42107f..254dc3e 100644 --- a/chrome/browser/ui/cocoa/table_row_nsimage_cache.h +++ b/chrome/browser/ui/cocoa/table_row_nsimage_cache.h @@ -32,6 +32,7 @@ class TableRowNSImageCache { // |model| must outlive the cache. explicit TableRowNSImageCache(Table* model); + ~TableRowNSImageCache(); // Lazily converts the image at the given row and caches it in |icon_images_|. NSImage* GetImageForRow(int row); diff --git a/chrome/browser/ui/cocoa/table_row_nsimage_cache.mm b/chrome/browser/ui/cocoa/table_row_nsimage_cache.mm index ae60dd6..ff36a50 100644 --- a/chrome/browser/ui/cocoa/table_row_nsimage_cache.mm +++ b/chrome/browser/ui/cocoa/table_row_nsimage_cache.mm @@ -17,6 +17,8 @@ TableRowNSImageCache::TableRowNSImageCache(Table* model) [icon_images_ setCount:count]; } +TableRowNSImageCache::~TableRowNSImageCache() {} + void TableRowNSImageCache::OnModelChanged() { int count = model_->RowCount(); [icon_images_ setCount:0]; diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 77c7c3e..a8888df 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -2301,6 +2301,7 @@ 'browser/ui/cocoa/bookmarks/bookmark_menu_bridge.mm', 'browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.h', 'browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm', + 'browser/ui/cocoa/bookmarks/bookmark_model_observer_for_cocoa.mm', 'browser/ui/cocoa/bookmarks/bookmark_model_observer_for_cocoa.h', 'browser/ui/cocoa/bookmarks/bookmark_name_folder_controller.h', 'browser/ui/cocoa/bookmarks/bookmark_name_folder_controller.mm', |