diff options
Diffstat (limited to 'ui')
82 files changed, 310 insertions, 297 deletions
diff --git a/ui/app_list/cocoa/app_list_view_controller.h b/ui/app_list/cocoa/app_list_view_controller.h index e0e1ad7..95d8708 100644 --- a/ui/app_list/cocoa/app_list_view_controller.h +++ b/ui/app_list/cocoa/app_list_view_controller.h @@ -7,7 +7,7 @@ #import <Cocoa/Cocoa.h> -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "base/memory/scoped_ptr.h" #include "ui/app_list/app_list_export.h" #import "ui/app_list/cocoa/apps_pagination_model_observer.h" @@ -30,11 +30,12 @@ APP_LIST_EXPORT AppsSearchBoxDelegate, AppsSearchResultsDelegate> { @private - scoped_nsobject<AppsGridController> appsGridController_; - scoped_nsobject<AppListPagerView> pagerControl_; - scoped_nsobject<AppsSearchBoxController> appsSearchBoxController_; - scoped_nsobject<AppsSearchResultsController> appsSearchResultsController_; - scoped_nsobject<NSView> contentsView_; + base::scoped_nsobject<AppsGridController> appsGridController_; + base::scoped_nsobject<AppListPagerView> pagerControl_; + base::scoped_nsobject<AppsSearchBoxController> appsSearchBoxController_; + base::scoped_nsobject<AppsSearchResultsController> + appsSearchResultsController_; + base::scoped_nsobject<NSView> contentsView_; scoped_ptr<app_list::AppListViewDelegate> delegate_; BOOL showingSearchResults_; } diff --git a/ui/app_list/cocoa/app_list_view_controller.mm b/ui/app_list/cocoa/app_list_view_controller.mm index 330c80d..7ef6bba 100644 --- a/ui/app_list/cocoa/app_list_view_controller.mm +++ b/ui/app_list/cocoa/app_list_view_controller.mm @@ -141,9 +141,9 @@ const NSTimeInterval kResultsAnimationDuration = 0.2; [AppsGridController scrollerPadding]); contentsView_.reset([[FlippedView alloc] initWithFrame:contentsRect]); - scoped_nsobject<BackgroundView> backgroundView( + base::scoped_nsobject<BackgroundView> backgroundView( [[BackgroundView alloc] initWithFrame: - NSMakeRect(0, 0, NSMaxX(contentsRect), NSMaxY(contentsRect))]); + NSMakeRect(0, 0, NSMaxX(contentsRect), NSMaxY(contentsRect))]); appsSearchBoxController_.reset( [[AppsSearchBoxController alloc] initWithFrame: NSMakeRect(0, 0, NSWidth(contentsRect), kSearchInputHeight)]); diff --git a/ui/app_list/cocoa/app_list_view_controller_unittest.mm b/ui/app_list/cocoa/app_list_view_controller_unittest.mm index 566819e..e14f884 100644 --- a/ui/app_list/cocoa/app_list_view_controller_unittest.mm +++ b/ui/app_list/cocoa/app_list_view_controller_unittest.mm @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #import "testing/gtest_mac.h" #import "ui/app_list/cocoa/app_list_view_controller.h" #import "ui/app_list/cocoa/apps_grid_controller.h" @@ -37,7 +37,7 @@ class AppListViewControllerTest : public AppsGridControllerTestHelper { } protected: - scoped_nsobject<AppListViewController> app_list_view_controller_; + base::scoped_nsobject<AppListViewController> app_list_view_controller_; private: DISALLOW_COPY_AND_ASSIGN(AppListViewControllerTest); diff --git a/ui/app_list/cocoa/app_list_window_controller.h b/ui/app_list/cocoa/app_list_window_controller.h index 57084ae..052682f 100644 --- a/ui/app_list/cocoa/app_list_window_controller.h +++ b/ui/app_list/cocoa/app_list_window_controller.h @@ -7,7 +7,7 @@ #import <Cocoa/Cocoa.h> -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "ui/app_list/app_list_export.h" @class AppListViewController; @@ -16,7 +16,7 @@ APP_LIST_EXPORT @interface AppListWindowController : NSWindowController<NSWindowDelegate> { @private - scoped_nsobject<AppListViewController> appListViewController_; + base::scoped_nsobject<AppListViewController> appListViewController_; } - (AppListViewController*)appListViewController; diff --git a/ui/app_list/cocoa/app_list_window_controller.mm b/ui/app_list/cocoa/app_list_window_controller.mm index 94ee7ef..0eb5b2c 100644 --- a/ui/app_list/cocoa/app_list_window_controller.mm +++ b/ui/app_list/cocoa/app_list_window_controller.mm @@ -29,7 +29,7 @@ @implementation AppListWindowController; - (id)init { - scoped_nsobject<NSWindow> controlledWindow( + base::scoped_nsobject<NSWindow> controlledWindow( [[AppListWindow alloc] initWithContentRect:ui::kWindowSizeDeterminedLater styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered diff --git a/ui/app_list/cocoa/app_list_window_controller_unittest.mm b/ui/app_list/cocoa/app_list_window_controller_unittest.mm index 12cccdb..8ea3544 100644 --- a/ui/app_list/cocoa/app_list_window_controller_unittest.mm +++ b/ui/app_list/cocoa/app_list_window_controller_unittest.mm @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "base/memory/scoped_nsobject.h" +#import "base/mac/scoped_nsobject.h" #import "testing/gtest_mac.h" #include "ui/app_list/app_list_view_delegate.h" #import "ui/app_list/cocoa/app_list_view_controller.h" @@ -19,7 +19,7 @@ class AppListWindowControllerTest : public ui::CocoaTest { protected: virtual void TearDown() OVERRIDE; - scoped_nsobject<AppListWindowController> controller_; + base::scoped_nsobject<AppListWindowController> controller_; app_list::test::AppListTestViewDelegate* delegate() { return static_cast<app_list::test::AppListTestViewDelegate*>( diff --git a/ui/app_list/cocoa/apps_collection_view_drag_manager.h b/ui/app_list/cocoa/apps_collection_view_drag_manager.h index 79b77bb..e8b5caf 100644 --- a/ui/app_list/cocoa/apps_collection_view_drag_manager.h +++ b/ui/app_list/cocoa/apps_collection_view_drag_manager.h @@ -7,7 +7,7 @@ #import <Cocoa/Cocoa.h> -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "ui/app_list/app_list_export.h" @class AppsGridController; @@ -19,7 +19,7 @@ APP_LIST_EXPORT @interface AppsCollectionViewDragManager : NSObject { @private - scoped_nsobject<ItemDragController> itemDragController_; + base::scoped_nsobject<ItemDragController> itemDragController_; AppsGridController* gridController_; // Weak. Owns us. NSSize cellSize_; diff --git a/ui/app_list/cocoa/apps_collection_view_drag_manager.mm b/ui/app_list/cocoa/apps_collection_view_drag_manager.mm index f759888..a7cc8b2 100644 --- a/ui/app_list/cocoa/apps_collection_view_drag_manager.mm +++ b/ui/app_list/cocoa/apps_collection_view_drag_manager.mm @@ -59,7 +59,7 @@ const CGFloat kDragThreshold = 5; } - (NSCollectionView*)makePageWithFrame:(NSRect)pageFrame { - scoped_nsobject<GridCollectionView> itemCollectionView( + base::scoped_nsobject<GridCollectionView> itemCollectionView( [[GridCollectionView alloc] initWithFrame:pageFrame]); [itemCollectionView setFactory:self]; [itemCollectionView setMaxNumberOfRows:rows_]; @@ -70,7 +70,7 @@ const CGFloat kDragThreshold = 5; [itemCollectionView setBackgroundColors: [NSArray arrayWithObject:[NSColor clearColor]]]; - scoped_nsobject<AppsGridViewItem> itemPrototype( + base::scoped_nsobject<AppsGridViewItem> itemPrototype( [[AppsGridViewItem alloc] initWithSize:cellSize_]); [[itemPrototype button] setTarget:gridController_]; [[itemPrototype button] setAction:@selector(onItemClicked:)]; diff --git a/ui/app_list/cocoa/apps_grid_controller.h b/ui/app_list/cocoa/apps_grid_controller.h index 7db9fbf..7b3db09 100644 --- a/ui/app_list/cocoa/apps_grid_controller.h +++ b/ui/app_list/cocoa/apps_grid_controller.h @@ -7,7 +7,7 @@ #import <Cocoa/Cocoa.h> -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "base/memory/scoped_ptr.h" #include "ui/app_list/app_list_export.h" #import "ui/app_list/cocoa/app_list_pager_view.h" @@ -32,10 +32,10 @@ APP_LIST_EXPORT app_list::AppListViewDelegate* delegate_; // Weak. Owned by view controller. scoped_ptr<app_list::AppsGridDelegateBridge> bridge_; - scoped_nsobject<AppsCollectionViewDragManager> dragManager_; - scoped_nsobject<NSMutableArray> pages_; - scoped_nsobject<NSMutableArray> items_; - scoped_nsobject<NSTimer> scrollWhileDraggingTimer_; + base::scoped_nsobject<AppsCollectionViewDragManager> dragManager_; + base::scoped_nsobject<NSMutableArray> pages_; + base::scoped_nsobject<NSMutableArray> items_; + base::scoped_nsobject<NSTimer> scrollWhileDraggingTimer_; id<AppsPaginationModelObserver> paginationObserver_; diff --git a/ui/app_list/cocoa/apps_grid_controller.mm b/ui/app_list/cocoa/apps_grid_controller.mm index 6d556426..200e853 100644 --- a/ui/app_list/cocoa/apps_grid_controller.mm +++ b/ui/app_list/cocoa/apps_grid_controller.mm @@ -340,12 +340,12 @@ class AppsGridDelegateBridge : public ui::ListModelObserver { } - (void)loadAndSetView { - scoped_nsobject<PageContainerView> pagesContainer( + base::scoped_nsobject<PageContainerView> pagesContainer( [[PageContainerView alloc] initWithFrame:NSZeroRect]); NSRect scrollFrame = NSMakeRect(0, kGridTopPadding, kViewWidth, kViewHeight + kScrollerPadding); - scoped_nsobject<ScrollViewWithNoScrollbars> scrollView( + base::scoped_nsobject<ScrollViewWithNoScrollbars> scrollView( [[ScrollViewWithNoScrollbars alloc] initWithFrame:scrollFrame]); [scrollView setBorderType:NSNoBorder]; [scrollView setLineScroll:kViewWidth]; @@ -499,7 +499,8 @@ class AppsGridDelegateBridge : public ui::ListModelObserver { - (void)moveItemInView:(size_t)fromIndex toItemIndex:(size_t)toIndex { - scoped_nsobject<NSValue> item([[items_ objectAtIndex:fromIndex] retain]); + base::scoped_nsobject<NSValue> item( + [[items_ objectAtIndex:fromIndex] retain]); [items_ removeObjectAtIndex:fromIndex]; [items_ insertObject:item atIndex:toIndex]; diff --git a/ui/app_list/cocoa/apps_grid_controller_unittest.mm b/ui/app_list/cocoa/apps_grid_controller_unittest.mm index 426a390..7e31cdc 100644 --- a/ui/app_list/cocoa/apps_grid_controller_unittest.mm +++ b/ui/app_list/cocoa/apps_grid_controller_unittest.mm @@ -3,7 +3,7 @@ // found in the LICENSE file. #include "base/mac/foundation_util.h" -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "base/strings/utf_string_conversions.h" #include "skia/ext/skia_utils_mac.h" #import "testing/gtest_mac.h" @@ -114,7 +114,7 @@ class AppsGridControllerTest : public AppsGridControllerTestHelper { } private: - scoped_nsobject<AppsGridController> owned_apps_grid_controller_; + base::scoped_nsobject<AppsGridController> owned_apps_grid_controller_; scoped_ptr<AppListTestViewDelegate> owned_delegate_; DISALLOW_COPY_AND_ASSIGN(AppsGridControllerTest); @@ -502,7 +502,7 @@ TEST_F(AppsGridControllerTest, MouseoverSelects) { // Test AppsGridPaginationObserver totalPagesChanged(). TEST_F(AppsGridControllerTest, PaginationObserverPagesChanged) { - scoped_nsobject<TestPaginationObserver> observer( + base::scoped_nsobject<TestPaginationObserver> observer( [[TestPaginationObserver alloc] init]); [apps_grid_controller_ setPaginationObserver:observer]; @@ -528,7 +528,7 @@ TEST_F(AppsGridControllerTest, PaginationObserverPagesChanged) { // Test AppsGridPaginationObserver selectedPageChanged(). TEST_F(AppsGridControllerTest, PaginationObserverSelectedPageChanged) { - scoped_nsobject<TestPaginationObserver> observer( + base::scoped_nsobject<TestPaginationObserver> observer( [[TestPaginationObserver alloc] init]); [apps_grid_controller_ setPaginationObserver:observer]; EXPECT_EQ(0, [[NSAnimationContext currentContext] duration]); @@ -749,7 +749,7 @@ TEST_F(AppsGridControllerTest, DragAndDropMultiPage) { // Test scrolling when dragging past edge or over the pager. TEST_F(AppsGridControllerTest, ScrollingWhileDragging) { - scoped_nsobject<TestPaginationObserver> observer( + base::scoped_nsobject<TestPaginationObserver> observer( [[TestPaginationObserver alloc] init]); [apps_grid_controller_ setPaginationObserver:observer]; diff --git a/ui/app_list/cocoa/apps_grid_view_item.mm b/ui/app_list/cocoa/apps_grid_view_item.mm index 7059505..ee44394 100644 --- a/ui/app_list/cocoa/apps_grid_view_item.mm +++ b/ui/app_list/cocoa/apps_grid_view_item.mm @@ -5,7 +5,7 @@ #import "ui/app_list/cocoa/apps_grid_view_item.h" #include "base/mac/foundation_util.h" -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "base/strings/sys_string_conversions.h" #include "skia/ext/skia_utils_mac.h" #include "ui/app_list/app_list_constants.h" @@ -13,8 +13,8 @@ #include "ui/app_list/app_list_item_model_observer.h" #import "ui/base/cocoa/menu_controller.h" #include "ui/base/resource/resource_bundle.h" -#include "ui/gfx/image/image_skia_util_mac.h" #include "ui/gfx/font.h" +#include "ui/gfx/image/image_skia_util_mac.h" #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" namespace { @@ -43,7 +43,7 @@ class ItemModelObserverBridge : public app_list::AppListItemModelObserver { private: AppsGridViewItem* parent_; // Weak. Owns us. AppListItemModel* model_; // Weak. Owned by AppListModel::Apps. - scoped_nsobject<MenuController> context_menu_controller_; + base::scoped_nsobject<MenuController> context_menu_controller_; DISALLOW_COPY_AND_ASSIGN(ItemModelObserverBridge); }; @@ -172,7 +172,7 @@ void ItemModelObserverBridge::ItemPercentDownloadedChanged() { - (id)initWithSize:(NSSize)tileSize { if ((self = [super init])) { - scoped_nsobject<AppsGridItemButton> prototypeButton( + base::scoped_nsobject<AppsGridItemButton> prototypeButton( [[AppsGridItemButton alloc] initWithFrame:NSMakeRect( 0, 0, tileSize.width, tileSize.height - kTileTopPadding)]); @@ -183,9 +183,9 @@ void ItemModelObserverBridge::ItemPercentDownloadedChanged() { [prototypeButton setButtonType:NSMomentaryChangeButton]; [prototypeButton setBordered:NO]; - scoped_nsobject<AppsGridItemBackgroundView> prototypeButtonBackground( - [[AppsGridItemBackgroundView alloc] initWithFrame:NSMakeRect( - 0, 0, tileSize.width, tileSize.height)]); + base::scoped_nsobject<AppsGridItemBackgroundView> prototypeButtonBackground( + [[AppsGridItemBackgroundView alloc] + initWithFrame:NSMakeRect(0, 0, tileSize.width, tileSize.height)]); [prototypeButtonBackground addSubview:prototypeButton]; [self setView:prototypeButtonBackground]; } @@ -197,7 +197,7 @@ void ItemModelObserverBridge::ItemPercentDownloadedChanged() { } - (void)setButtonTitle:(NSString*)newTitle { - scoped_nsobject<NSMutableParagraphStyle> paragraphStyle( + base::scoped_nsobject<NSMutableParagraphStyle> paragraphStyle( [[NSMutableParagraphStyle alloc] init]); [paragraphStyle setLineBreakMode:NSLineBreakByTruncatingTail]; [paragraphStyle setAlignment:NSCenterTextAlignment]; @@ -209,7 +209,7 @@ void ItemModelObserverBridge::ItemPercentDownloadedChanged() { gfx::SkColorToCalibratedNSColor(app_list::kGridTitleHoverColor) : gfx::SkColorToCalibratedNSColor(app_list::kGridTitleColor) }; - scoped_nsobject<NSAttributedString> attributedTitle( + base::scoped_nsobject<NSAttributedString> attributedTitle( [[NSAttributedString alloc] initWithString:newTitle attributes:titleAttributes]); [[self button] setAttributedTitle:attributedTitle]; @@ -300,7 +300,7 @@ void ItemModelObserverBridge::ItemPercentDownloadedChanged() { return; } - scoped_nsobject<NSShadow> shadow([[NSShadow alloc] init]); + base::scoped_nsobject<NSShadow> shadow([[NSShadow alloc] init]); gfx::ScopedNSGraphicsContextSaveGState context; [shadow setShadowOffset:NSMakeSize(0, -2)]; [shadow setShadowBlurRadius:2.0]; diff --git a/ui/app_list/cocoa/apps_search_box_controller.h b/ui/app_list/cocoa/apps_search_box_controller.h index f373235..3e9b4b2 100644 --- a/ui/app_list/cocoa/apps_search_box_controller.h +++ b/ui/app_list/cocoa/apps_search_box_controller.h @@ -7,7 +7,7 @@ #import <Cocoa/Cocoa.h> -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "base/memory/scoped_ptr.h" #include "ui/app_list/app_list_export.h" @@ -34,10 +34,10 @@ class SearchBoxModelObserverBridge; APP_LIST_EXPORT @interface AppsSearchBoxController : NSViewController<NSTextFieldDelegate> { @private - scoped_nsobject<SearchTextField> searchTextField_; - scoped_nsobject<NSImageView> searchImageView_; - scoped_nsobject<HoverImageMenuButton> menuButton_; - scoped_nsobject<AppListMenuController> menuController_; + base::scoped_nsobject<SearchTextField> searchTextField_; + base::scoped_nsobject<NSImageView> searchImageView_; + base::scoped_nsobject<HoverImageMenuButton> menuButton_; + base::scoped_nsobject<AppListMenuController> menuController_; scoped_ptr<app_list::SearchBoxModelObserverBridge> bridge_; scoped_ptr<app_list::AppListMenu> appListMenu_; diff --git a/ui/app_list/cocoa/apps_search_box_controller.mm b/ui/app_list/cocoa/apps_search_box_controller.mm index 534a064..0456c16 100644 --- a/ui/app_list/cocoa/apps_search_box_controller.mm +++ b/ui/app_list/cocoa/apps_search_box_controller.mm @@ -139,7 +139,8 @@ void SearchBoxModelObserverBridge::TextChanged() { - (id)initWithFrame:(NSRect)frame { if ((self = [super init])) { - scoped_nsobject<NSView> containerView([[NSView alloc] initWithFrame:frame]); + base::scoped_nsobject<NSView> containerView( + [[NSView alloc] initWithFrame:frame]); [self setView:containerView]; [self addSubviews]; } @@ -370,7 +371,7 @@ void SearchBoxModelObserverBridge::TextChanged() { if (model->GetCommandIdAt(index) != app_list::AppListMenu::CURRENT_USER) return; - scoped_nsobject<NSView> customItemView([[CurrentUserMenuItemView alloc] + base::scoped_nsobject<NSView> customItemView([[CurrentUserMenuItemView alloc] initWithDelegate:[[searchBoxController_ delegate] appListDelegate]]); [[menu itemAtIndex:index] setView:customItemView]; } diff --git a/ui/app_list/cocoa/apps_search_box_controller_unittest.mm b/ui/app_list/cocoa/apps_search_box_controller_unittest.mm index e2c2563..d702549 100644 --- a/ui/app_list/cocoa/apps_search_box_controller_unittest.mm +++ b/ui/app_list/cocoa/apps_search_box_controller_unittest.mm @@ -4,7 +4,7 @@ #import "ui/app_list/cocoa/apps_search_box_controller.h" -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" #import "testing/gtest_mac.h" @@ -87,8 +87,8 @@ class AppsSearchBoxControllerTest : public ui::CocoaTest { } protected: - scoped_nsobject<TestAppsSearchBoxDelegate> delegate_; - scoped_nsobject<AppsSearchBoxController> apps_search_box_controller_; + base::scoped_nsobject<TestAppsSearchBoxDelegate> delegate_; + base::scoped_nsobject<AppsSearchBoxController> apps_search_box_controller_; private: DISALLOW_COPY_AND_ASSIGN(AppsSearchBoxControllerTest); @@ -176,7 +176,7 @@ class AppsSearchBoxCustomMenuItemTest : public ui::CocoaTest { } protected: - scoped_nsobject<NSView> current_user_menu_item_; + base::scoped_nsobject<NSView> current_user_menu_item_; private: DISALLOW_COPY_AND_ASSIGN(AppsSearchBoxCustomMenuItemTest); diff --git a/ui/app_list/cocoa/apps_search_results_controller.h b/ui/app_list/cocoa/apps_search_results_controller.h index e135087..b69fc51 100644 --- a/ui/app_list/cocoa/apps_search_results_controller.h +++ b/ui/app_list/cocoa/apps_search_results_controller.h @@ -7,7 +7,7 @@ #import <Cocoa/Cocoa.h> -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "base/memory/scoped_ptr.h" #include "ui/app_list/app_list_export.h" #import "ui/base/cocoa/tracking_area.h" @@ -35,7 +35,7 @@ APP_LIST_EXPORT @interface AppsSearchResultsController : NSViewController<NSTableViewDelegate, NSTableViewDataSource> { @private - scoped_nsobject<NSTableView> tableView_; + base::scoped_nsobject<NSTableView> tableView_; ui::ScopedCrTrackingArea trackingArea_; NSPoint lastMouseDownInView_; NSInteger hoveredRowIndex_; diff --git a/ui/app_list/cocoa/apps_search_results_controller.mm b/ui/app_list/cocoa/apps_search_results_controller.mm index ecc1660..5d4f754a 100644 --- a/ui/app_list/cocoa/apps_search_results_controller.mm +++ b/ui/app_list/cocoa/apps_search_results_controller.mm @@ -46,8 +46,8 @@ const NSBackgroundStyle kBackgroundHovered = NSBackgroundStyleRaised; // Immutable class representing a search result in the NSTableView. @interface AppsSearchResultRep : NSObject<NSCopying> { @private - scoped_nsobject<NSAttributedString> attributedStringValue_; - scoped_nsobject<NSImage> resultIcon_; + base::scoped_nsobject<NSAttributedString> attributedStringValue_; + base::scoped_nsobject<NSImage> resultIcon_; } @property(readonly, nonatomic) NSAttributedString* attributedStringValue; @@ -140,9 +140,9 @@ const NSBackgroundStyle kBackgroundHovered = NSBackgroundStyleRaised; userInfo:nil]); [tableView_ addTrackingArea:trackingArea_.get()]; - scoped_nsobject<NSTableColumn> resultsColumn( + base::scoped_nsobject<NSTableColumn> resultsColumn( [[NSTableColumn alloc] initWithIdentifier:@""]); - scoped_nsobject<NSCell> resultsDataCell( + base::scoped_nsobject<NSCell> resultsDataCell( [[AppsSearchResultsCell alloc] initTextCell:@""]); [resultsColumn setDataCell:resultsDataCell]; [resultsColumn setWidth:size.width]; @@ -151,13 +151,13 @@ const NSBackgroundStyle kBackgroundHovered = NSBackgroundStyleRaised; // An NSTableView is normally put in a NSScrollView, but scrolling is not // used for the app list. Instead, place it in a container with the desired // size; flipped so the table is anchored to the top-left. - scoped_nsobject<FlippedView> containerView([[FlippedView alloc] initWithFrame: - NSMakeRect(0, 0, size.width, size.height)]); + base::scoped_nsobject<FlippedView> containerView([[FlippedView alloc] + initWithFrame:NSMakeRect(0, 0, size.width, size.height)]); // The container is then anchored in an un-flipped view, initially hidden, // so that |containerView| slides in from the top when showing results. - scoped_nsobject<NSView> clipView([[NSView alloc] initWithFrame: - NSMakeRect(0, 0, size.width, 0)]); + base::scoped_nsobject<NSView> clipView( + [[NSView alloc] initWithFrame:NSMakeRect(0, 0, size.width, 0)]); [containerView addSubview:tableView_]; [clipView addSubview:containerView]; @@ -236,8 +236,9 @@ const NSBackgroundStyle kBackgroundHovered = NSBackgroundStyleRaised; byExtendingSelection:NO]; } - scoped_nsobject<AppsSearchResultRep> resultRep([[AppsSearchResultRep alloc] - initWithSearchResult:[self searchResults]->GetItemAt(rowIndex)]); + base::scoped_nsobject<AppsSearchResultRep> resultRep( + [[AppsSearchResultRep alloc] + initWithSearchResult:[self searchResults]->GetItemAt(rowIndex)]); return resultRep.autorelease(); } @@ -300,7 +301,7 @@ const NSBackgroundStyle kBackgroundHovered = NSBackgroundStyleRaised; - (NSMutableAttributedString*)createRenderText:(const base::string16&)content tags:(const app_list::SearchResult::Tags&)tags { NSFont* boldFont = nil; - scoped_nsobject<NSMutableParagraphStyle> paragraphStyle( + base::scoped_nsobject<NSMutableParagraphStyle> paragraphStyle( [[NSMutableParagraphStyle alloc] init]); [paragraphStyle setLineBreakMode:NSLineBreakByTruncatingTail]; NSDictionary* defaultAttributes = @{ @@ -309,7 +310,7 @@ const NSBackgroundStyle kBackgroundHovered = NSBackgroundStyleRaised; NSParagraphStyleAttributeName: paragraphStyle }; - scoped_nsobject<NSMutableAttributedString> text( + base::scoped_nsobject<NSMutableAttributedString> text( [[NSMutableAttributedString alloc] initWithString:base::SysUTF16ToNSString(content) attributes:defaultAttributes]); @@ -357,7 +358,7 @@ const NSBackgroundStyle kBackgroundHovered = NSBackgroundStyleRaised; NSMutableAttributedString* detailText = [self createRenderText:result->details() tags:result->details_tags()]; - scoped_nsobject<NSAttributedString> lineBreak( + base::scoped_nsobject<NSAttributedString> lineBreak( [[NSAttributedString alloc] initWithString:@"\n"]); [titleText appendAttributedString:lineBreak]; [titleText appendAttributedString:detailText]; diff --git a/ui/app_list/cocoa/apps_search_results_controller_unittest.mm b/ui/app_list/cocoa/apps_search_results_controller_unittest.mm index e93fb1f..cb170dc 100644 --- a/ui/app_list/cocoa/apps_search_results_controller_unittest.mm +++ b/ui/app_list/cocoa/apps_search_results_controller_unittest.mm @@ -4,7 +4,7 @@ #import "ui/app_list/cocoa/apps_search_results_controller.h" -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "base/strings/stringprintf.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" @@ -82,8 +82,9 @@ class AppsSearchResultsControllerTest : public ui::CocoaTest { virtual void TearDown() OVERRIDE; protected: - scoped_nsobject<TestAppsSearchResultsDelegate> delegate_; - scoped_nsobject<AppsSearchResultsController> apps_search_results_controller_; + base::scoped_nsobject<TestAppsSearchResultsDelegate> delegate_; + base::scoped_nsobject<AppsSearchResultsController> + apps_search_results_controller_; private: DISALLOW_COPY_AND_ASSIGN(AppsSearchResultsControllerTest); diff --git a/ui/app_list/cocoa/apps_search_results_model_bridge.h b/ui/app_list/cocoa/apps_search_results_model_bridge.h index f689890..3f40862 100644 --- a/ui/app_list/cocoa/apps_search_results_model_bridge.h +++ b/ui/app_list/cocoa/apps_search_results_model_bridge.h @@ -5,7 +5,7 @@ #ifndef UI_APP_LIST_COCOA_APPS_SEARCH_RESULTS_MODEL_BRIDGE_H_ #define UI_APP_LIST_COCOA_APPS_SEARCH_RESULTS_MODEL_BRIDGE_H_ -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "base/memory/scoped_vector.h" #include "ui/app_list/app_list_model.h" #include "ui/base/models/list_model_observer.h" @@ -36,7 +36,7 @@ class AppsSearchResultsModelBridge : public ui::ListModelObserver { virtual void ListItemsChanged(size_t start, size_t count) OVERRIDE; AppListModel::SearchResults* results_; // Weak. Owned by AppListModel. - scoped_nsobject<NSTableView> table_view_; + base::scoped_nsobject<NSTableView> table_view_; ScopedVector<ItemObserver> item_observers_; DISALLOW_COPY_AND_ASSIGN(AppsSearchResultsModelBridge); diff --git a/ui/app_list/cocoa/current_user_menu_item_view.mm b/ui/app_list/cocoa/current_user_menu_item_view.mm index dcc4838..6aac34c6 100644 --- a/ui/app_list/cocoa/current_user_menu_item_view.mm +++ b/ui/app_list/cocoa/current_user_menu_item_view.mm @@ -5,7 +5,7 @@ #import "ui/app_list/cocoa/current_user_menu_item_view.h" #include "base/logging.h" -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "base/strings/sys_string_conversions.h" #include "grit/ui_resources.h" #include "ui/app_list/app_list_view_delegate.h" @@ -35,7 +35,7 @@ const CGFloat kMenuLeftMargin = 3; GetNativeImageNamed(IDR_APP_LIST_USER_INDICATOR).AsNSImage(); NSRect imageRect = NSMakeRect(kMenuLeftMargin, 0, 0, 0); imageRect.size = [userImage size]; - scoped_nsobject<NSImageView> userImageView( + base::scoped_nsobject<NSImageView> userImageView( [[NSImageView alloc] initWithFrame:imageRect]); [userImageView setImage:userImage]; [self addSubview:userImageView]; @@ -66,7 +66,7 @@ const CGFloat kMenuLeftMargin = 3; labelText:(const string16&)labelText { NSRect labelFrame = NSZeroRect; labelFrame.origin = origin; - scoped_nsobject<NSTextField> label( + base::scoped_nsobject<NSTextField> label( [[NSTextField alloc] initWithFrame:labelFrame]); [label setStringValue:base::SysUTF16ToNSString(labelText)]; [label setEditable:NO]; diff --git a/ui/app_list/cocoa/item_drag_controller.h b/ui/app_list/cocoa/item_drag_controller.h index aaa87bc..4e1c747 100644 --- a/ui/app_list/cocoa/item_drag_controller.h +++ b/ui/app_list/cocoa/item_drag_controller.h @@ -8,7 +8,7 @@ #import <Cocoa/Cocoa.h> #import <QuartzCore/QuartzCore.h> -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" @class AppsGridViewItem; @@ -19,8 +19,8 @@ // item location in the grid. @interface ItemDragController : NSViewController { @private - scoped_nsobject<CALayer> dragLayer_; - scoped_nsobject<NSButton> buttonToRestore_; + base::scoped_nsobject<CALayer> dragLayer_; + base::scoped_nsobject<NSButton> buttonToRestore_; NSPoint mouseOffset_; NSTimeInterval growStart_; BOOL shrinking_; diff --git a/ui/app_list/cocoa/item_drag_controller.mm b/ui/app_list/cocoa/item_drag_controller.mm index 66a5fdd..994ac9d 100644 --- a/ui/app_list/cocoa/item_drag_controller.mm +++ b/ui/app_list/cocoa/item_drag_controller.mm @@ -37,7 +37,8 @@ NSString* const kGrowAnimationKey = @"growAnimation"; 0, size.width * kDraggingIconScale, size.height * kDraggingIconScale); - scoped_nsobject<NSView> dragView([[NSView alloc] initWithFrame:frameRect]); + base::scoped_nsobject<NSView> dragView( + [[NSView alloc] initWithFrame:frameRect]); [dragView setWantsLayer:YES]; [dragView setHidden:YES]; @@ -65,7 +66,7 @@ NSString* const kGrowAnimationKey = @"growAnimation"; // Take a snapshot of the grid cell without the text label and hide the cell. // Also remove the cell highlight on the image, added when it was clicked. NSButton* button = [item button]; - scoped_nsobject<NSString> oldTitle([[item buttonTitle] retain]); + base::scoped_nsobject<NSString> oldTitle([[item buttonTitle] retain]); [item setButtonTitle:[NSString string]]; [[button cell] setHighlighted:NO]; NSBitmapImageRep* imageRep = @@ -160,7 +161,7 @@ NSString* const kGrowAnimationKey = @"growAnimation"; NSViewAnimationEndFrameKey: [NSValue valueWithRect:targetRect] }; - scoped_nsobject<NSViewAnimation> translate([[NSViewAnimation alloc] + base::scoped_nsobject<NSViewAnimation> translate([[NSViewAnimation alloc] initWithViewAnimations:[NSArray arrayWithObject:animationDict]]); [translate setDuration:kAnimationDuration]; [translate startAnimation]; diff --git a/ui/app_list/cocoa/scroll_view_with_no_scrollbars.mm b/ui/app_list/cocoa/scroll_view_with_no_scrollbars.mm index 2057cfe..e200209 100644 --- a/ui/app_list/cocoa/scroll_view_with_no_scrollbars.mm +++ b/ui/app_list/cocoa/scroll_view_with_no_scrollbars.mm @@ -5,7 +5,7 @@ #include "ui/app_list/cocoa/scroll_view_with_no_scrollbars.h" #include "base/mac/mac_util.h" -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #if !defined(MAC_OS_X_VERSION_10_7) || \ MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 @@ -52,7 +52,7 @@ typedef NSUInteger NSEventPhase; [self setHasHorizontalScroller:base::mac::IsOSLionOrLater()]; NSRect horizontalScrollerRect = [self bounds]; horizontalScrollerRect.size.height = 0; - scoped_nsobject<InvisibleScroller> horizontalScroller( + base::scoped_nsobject<InvisibleScroller> horizontalScroller( [[InvisibleScroller alloc] initWithFrame:horizontalScrollerRect]); [self setHorizontalScroller:horizontalScroller]; } diff --git a/ui/aura/root_window_host_mac.mm b/ui/aura/root_window_host_mac.mm index 35b1fc0..28943a9 100644 --- a/ui/aura/root_window_host_mac.mm +++ b/ui/aura/root_window_host_mac.mm @@ -8,7 +8,7 @@ #include "base/compiler_specific.h" #include "base/mac/bundle_locations.h" -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "ui/aura/event.h" #include "ui/aura/root_window.h" #include "ui/aura/root_window_host.h" @@ -67,7 +67,7 @@ class RootWindowHostMac : public RootWindowHost, // An NSWindowController for the root window. Controls the actual Cocoa // window on Mac. - scoped_nsobject<NSWindowController> controller_; + base::scoped_nsobject<NSWindowController> controller_; DISALLOW_COPY_AND_ASSIGN(RootWindowHostMac); }; diff --git a/ui/base/accelerators/platform_accelerator_cocoa.h b/ui/base/accelerators/platform_accelerator_cocoa.h index 5ac8261..30941c7 100644 --- a/ui/base/accelerators/platform_accelerator_cocoa.h +++ b/ui/base/accelerators/platform_accelerator_cocoa.h @@ -7,7 +7,7 @@ #include <Foundation/Foundation.h> -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "ui/base/accelerators/platform_accelerator.h" namespace ui { @@ -28,7 +28,7 @@ class UI_EXPORT PlatformAcceleratorCocoa : public PlatformAccelerator { private: // String of characters for the key equivalent. - scoped_nsobject<NSString> characters_; + base::scoped_nsobject<NSString> characters_; NSUInteger modifier_mask_; DISALLOW_COPY_AND_ASSIGN(PlatformAcceleratorCocoa); diff --git a/ui/base/clipboard/clipboard_mac.mm b/ui/base/clipboard/clipboard_mac.mm index bb5bfae..575fe5a 100644 --- a/ui/base/clipboard/clipboard_mac.mm +++ b/ui/base/clipboard/clipboard_mac.mm @@ -11,7 +11,7 @@ #include "base/logging.h" #include "base/mac/mac_util.h" #include "base/mac/scoped_cftyperef.h" -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "base/stl_util.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" @@ -185,11 +185,11 @@ void Clipboard::WriteBitmap(const char* pixel_data, const char* size_data) { data_provider.reset(); data.reset(); - scoped_nsobject<NSBitmapImageRep> bitmap( + base::scoped_nsobject<NSBitmapImageRep> bitmap( [[NSBitmapImageRep alloc] initWithCGImage:cgimage]); cgimage.reset(); - scoped_nsobject<NSImage> image([[NSImage alloc] init]); + base::scoped_nsobject<NSImage> image([[NSImage alloc] init]); [image addRepresentation:bitmap]; // An API to ask the NSImage to write itself to the clipboard comes in 10.6 :( @@ -343,7 +343,7 @@ SkBitmap Clipboard::ReadImage(Buffer buffer) const { DCHECK(CalledOnValidThread()); DCHECK_EQ(buffer, BUFFER_STANDARD); - scoped_nsobject<NSImage> image( + base::scoped_nsobject<NSImage> image( [[NSImage alloc] initWithPasteboard:GetPasteboard()]); if (!image.get()) return SkBitmap(); diff --git a/ui/base/cocoa/base_view.h b/ui/base/cocoa/base_view.h index f9bc275..df634fc 100644 --- a/ui/base/cocoa/base_view.h +++ b/ui/base/cocoa/base_view.h @@ -7,9 +7,9 @@ #import <Cocoa/Cocoa.h> -#include "base/memory/scoped_nsobject.h" -#include "ui/base/ui_export.h" +#include "base/mac/scoped_nsobject.h" #import "ui/base/cocoa/tracking_area.h" +#include "ui/base/ui_export.h" #include "ui/gfx/rect.h" // A view that provides common functionality that many views will need: @@ -21,7 +21,7 @@ UI_EXPORT @private ui::ScopedCrTrackingArea trackingArea_; BOOL dragging_; - scoped_nsobject<NSEvent> pendingExitEvent_; + base::scoped_nsobject<NSEvent> pendingExitEvent_; } // Override these methods in a subclass. diff --git a/ui/base/cocoa/base_view_unittest.mm b/ui/base/cocoa/base_view_unittest.mm index a28c6d3..f9b0690 100644 --- a/ui/base/cocoa/base_view_unittest.mm +++ b/ui/base/cocoa/base_view_unittest.mm @@ -4,7 +4,7 @@ #import <Cocoa/Cocoa.h> -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" #include "ui/base/cocoa/base_view.h" @@ -16,7 +16,8 @@ class BaseViewTest : public ui::CocoaTest { public: BaseViewTest() { NSRect frame = NSMakeRect(0, 0, 100, 100); - scoped_nsobject<BaseView> view([[BaseView alloc] initWithFrame:frame]); + base::scoped_nsobject<BaseView> view( + [[BaseView alloc] initWithFrame:frame]); view_ = view.get(); [[test_window() contentView] addSubview:view_]; } diff --git a/ui/base/cocoa/controls/hover_image_menu_button_cell.h b/ui/base/cocoa/controls/hover_image_menu_button_cell.h index 1da338b..fad48fe 100644 --- a/ui/base/cocoa/controls/hover_image_menu_button_cell.h +++ b/ui/base/cocoa/controls/hover_image_menu_button_cell.h @@ -7,7 +7,7 @@ #import <Cocoa/Cocoa.h> -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "ui/base/ui_export.h" // A custom NSPopUpButtonCell that permits a hover image, and draws only an @@ -17,7 +17,7 @@ UI_EXPORT @interface HoverImageMenuButtonCell : NSPopUpButtonCell { @private - scoped_nsobject<NSImage> hoverImage_; + base::scoped_nsobject<NSImage> hoverImage_; BOOL hovered_; } diff --git a/ui/base/cocoa/controls/hover_image_menu_button_cell.mm b/ui/base/cocoa/controls/hover_image_menu_button_cell.mm index 32a9d69..10e93fb 100644 --- a/ui/base/cocoa/controls/hover_image_menu_button_cell.mm +++ b/ui/base/cocoa/controls/hover_image_menu_button_cell.mm @@ -51,7 +51,7 @@ } - (void)setDefaultImage:(NSImage*)defaultImage { - scoped_nsobject<NSMenuItem> buttonMenuItem([[NSMenuItem alloc] init]); + base::scoped_nsobject<NSMenuItem> buttonMenuItem([[NSMenuItem alloc] init]); [buttonMenuItem setImage:defaultImage]; [self setMenuItem:buttonMenuItem]; } diff --git a/ui/base/cocoa/controls/hover_image_menu_button_unittest.mm b/ui/base/cocoa/controls/hover_image_menu_button_unittest.mm index 45ed3689..bf64f40 100644 --- a/ui/base/cocoa/controls/hover_image_menu_button_unittest.mm +++ b/ui/base/cocoa/controls/hover_image_menu_button_unittest.mm @@ -23,10 +23,10 @@ class HoverImageMenuButtonTest : public CocoaTest { virtual void SetUp() OVERRIDE; protected: - scoped_nsobject<HoverImageMenuButton> menu_button_; - scoped_nsobject<NSImage> normal_; - scoped_nsobject<NSImage> pressed_; - scoped_nsobject<NSImage> hovered_; + base::scoped_nsobject<HoverImageMenuButton> menu_button_; + base::scoped_nsobject<NSImage> normal_; + base::scoped_nsobject<NSImage> pressed_; + base::scoped_nsobject<NSImage> hovered_; DISALLOW_COPY_AND_ASSIGN(HoverImageMenuButtonTest); }; diff --git a/ui/base/cocoa/find_pasteboard.h b/ui/base/cocoa/find_pasteboard.h index 92c3b0a..aada8a7 100644 --- a/ui/base/cocoa/find_pasteboard.h +++ b/ui/base/cocoa/find_pasteboard.h @@ -11,7 +11,7 @@ #import <Cocoa/Cocoa.h> -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "ui/base/ui_export.h" UI_EXPORT extern NSString* kFindPasteboardChangedNotification; @@ -28,7 +28,7 @@ UI_EXPORT extern NSString* kFindPasteboardChangedNotification; UI_EXPORT @interface FindPasteboard : NSObject { @private - scoped_nsobject<NSString> findText_; + base::scoped_nsobject<NSString> findText_; } // Returns the singleton instance of this class. diff --git a/ui/base/cocoa/focus_tracker.h b/ui/base/cocoa/focus_tracker.h index 82165c7..6a0c3ba 100644 --- a/ui/base/cocoa/focus_tracker.h +++ b/ui/base/cocoa/focus_tracker.h @@ -4,7 +4,7 @@ #import <Cocoa/Cocoa.h> -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "ui/base/ui_export.h" // A class that handles saving and restoring focus. An instance of @@ -15,7 +15,7 @@ UI_EXPORT @interface FocusTracker : NSObject { @private - scoped_nsobject<NSView> focusedView_; + base::scoped_nsobject<NSView> focusedView_; } // |window| is the window that we are saving focus for. This diff --git a/ui/base/cocoa/focus_tracker_unittest.mm b/ui/base/cocoa/focus_tracker_unittest.mm index 53aae6e..0fb70c1 100644 --- a/ui/base/cocoa/focus_tracker_unittest.mm +++ b/ui/base/cocoa/focus_tracker_unittest.mm @@ -4,7 +4,7 @@ #import <Cocoa/Cocoa.h> -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" #import "ui/base/cocoa/focus_tracker.h" @@ -16,7 +16,8 @@ class FocusTrackerTest : public ui::CocoaTest { public: virtual void SetUp() { ui::CocoaTest::SetUp(); - scoped_nsobject<NSView> view([[NSView alloc] initWithFrame:NSZeroRect]); + base::scoped_nsobject<NSView> view( + [[NSView alloc] initWithFrame:NSZeroRect]); viewA_ = view.get(); [[test_window() contentView] addSubview:viewA_]; @@ -33,7 +34,7 @@ class FocusTrackerTest : public ui::CocoaTest { TEST_F(FocusTrackerTest, SaveRestore) { NSWindow* window = test_window(); ASSERT_TRUE([window makeFirstResponder:viewA_]); - scoped_nsobject<FocusTracker> tracker( + base::scoped_nsobject<FocusTracker> tracker( [[FocusTracker alloc] initWithWindow:window]); // Give focus to |viewB_|, then try and restore it to view1. ASSERT_TRUE([window makeFirstResponder:viewB_]); @@ -45,12 +46,13 @@ TEST_F(FocusTrackerTest, SaveRestoreWithTextView) { // Valgrind will complain if the text field has zero size. NSRect frame = NSMakeRect(0, 0, 100, 20); NSWindow* window = test_window(); - scoped_nsobject<NSTextField> text([[NSTextField alloc] initWithFrame:frame]); + base::scoped_nsobject<NSTextField> text( + [[NSTextField alloc] initWithFrame:frame]); [[window contentView] addSubview:text]; ASSERT_TRUE([window makeFirstResponder:text]); - scoped_nsobject<FocusTracker> tracker([[FocusTracker alloc] - initWithWindow:window]); + base::scoped_nsobject<FocusTracker> tracker( + [[FocusTracker alloc] initWithWindow:window]); // Give focus to |viewB_|, then try and restore it to the text field. ASSERT_TRUE([window makeFirstResponder:viewB_]); EXPECT_TRUE([tracker restoreFocusInWindow:window]); @@ -59,11 +61,12 @@ TEST_F(FocusTrackerTest, SaveRestoreWithTextView) { TEST_F(FocusTrackerTest, DontRestoreToViewNotInWindow) { NSWindow* window = test_window(); - scoped_nsobject<NSView> viewC([[NSView alloc] initWithFrame:NSZeroRect]); + base::scoped_nsobject<NSView> viewC( + [[NSView alloc] initWithFrame:NSZeroRect]); [[window contentView] addSubview:viewC]; ASSERT_TRUE([window makeFirstResponder:viewC]); - scoped_nsobject<FocusTracker> tracker( + base::scoped_nsobject<FocusTracker> tracker( [[FocusTracker alloc] initWithWindow:window]); // Give focus to |viewB_|, then remove viewC from the hierarchy and try @@ -76,7 +79,7 @@ TEST_F(FocusTrackerTest, DontRestoreToViewNotInWindow) { TEST_F(FocusTrackerTest, DontRestoreFocusToViewInDifferentWindow) { NSWindow* window = test_window(); ASSERT_TRUE([window makeFirstResponder:viewA_]); - scoped_nsobject<FocusTracker> tracker( + base::scoped_nsobject<FocusTracker> tracker( [[FocusTracker alloc] initWithWindow:window]); // Give focus to |viewB_|, then try and restore focus in a different diff --git a/ui/base/cocoa/fullscreen_window_manager.h b/ui/base/cocoa/fullscreen_window_manager.h index 3258dff..1b18912 100644 --- a/ui/base/cocoa/fullscreen_window_manager.h +++ b/ui/base/cocoa/fullscreen_window_manager.h @@ -8,7 +8,7 @@ #import <Cocoa/Cocoa.h> #include "base/mac/mac_util.h" -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "ui/base/ui_export.h" // A utility class to manage the fullscreen mode for a given window. This class @@ -16,11 +16,11 @@ UI_EXPORT @interface FullscreenWindowManager : NSObject { @private - scoped_nsobject<NSWindow> window_; + base::scoped_nsobject<NSWindow> window_; // Explicitly keep track of the screen we want to position the window in. // This is better than using -[NSWindow screen] because that might change if // the screen changes to a low resolution. - scoped_nsobject<NSScreen> desiredScreen_; + base::scoped_nsobject<NSScreen> desiredScreen_; base::mac::FullScreenMode fullscreenMode_; BOOL fullscreenActive_; } diff --git a/ui/base/cocoa/fullscreen_window_manager_unittest.mm b/ui/base/cocoa/fullscreen_window_manager_unittest.mm index 710ec79..5f9ff2f 100644 --- a/ui/base/cocoa/fullscreen_window_manager_unittest.mm +++ b/ui/base/cocoa/fullscreen_window_manager_unittest.mm @@ -11,10 +11,9 @@ typedef ui::CocoaTest FullscreenWindowManagerTest; TEST_F(FullscreenWindowManagerTest, EnterExit) { - scoped_nsobject<FullscreenWindowManager> manager( - [[FullscreenWindowManager alloc] - initWithWindow:test_window() - desiredScreen:[NSScreen mainScreen]]); + base::scoped_nsobject<FullscreenWindowManager> manager( + [[FullscreenWindowManager alloc] initWithWindow:test_window() + desiredScreen:[NSScreen mainScreen]]); NSApplicationPresentationOptions current_options = [NSApp presentationOptions]; diff --git a/ui/base/cocoa/hover_button.h b/ui/base/cocoa/hover_button.h index e665d3a..e845d08 100644 --- a/ui/base/cocoa/hover_button.h +++ b/ui/base/cocoa/hover_button.h @@ -7,7 +7,7 @@ #import <Cocoa/Cocoa.h> -#import "base/memory/scoped_nsobject.h" +#import "base/mac/scoped_nsobject.h" #import "ui/base/cocoa/tracking_area.h" #import "ui/base/ui_export.h" diff --git a/ui/base/cocoa/hover_button.mm b/ui/base/cocoa/hover_button.mm index a234898..bfe0139 100644 --- a/ui/base/cocoa/hover_button.mm +++ b/ui/base/cocoa/hover_button.mm @@ -44,7 +44,7 @@ // it can be freed while |super mouseDown:| is in its loop, and the // |checkImageState| call will crash. // http://crbug.com/28220 - scoped_nsobject<HoverButton> myself([self retain]); + base::scoped_nsobject<HoverButton> myself([self retain]); [super mouseDown:theEvent]; // We need to check the image state after the mouseDown event loop finishes. diff --git a/ui/base/cocoa/hover_image_button.h b/ui/base/cocoa/hover_image_button.h index 42e0954..d43a7fa 100644 --- a/ui/base/cocoa/hover_image_button.h +++ b/ui/base/cocoa/hover_image_button.h @@ -7,7 +7,7 @@ #import <Cocoa/Cocoa.h> -#import "base/memory/scoped_nsobject.h" +#import "base/mac/scoped_nsobject.h" #import "ui/base/cocoa/hover_button.h" #include "ui/base/ui_export.h" @@ -15,9 +15,9 @@ UI_EXPORT @interface HoverImageButton : HoverButton { @private - scoped_nsobject<NSImage> defaultImage_; - scoped_nsobject<NSImage> hoverImage_; - scoped_nsobject<NSImage> pressedImage_; + base::scoped_nsobject<NSImage> defaultImage_; + base::scoped_nsobject<NSImage> hoverImage_; + base::scoped_nsobject<NSImage> pressedImage_; } // Sets the default image. diff --git a/ui/base/cocoa/hover_image_button_unittest.mm b/ui/base/cocoa/hover_image_button_unittest.mm index b8b5c37..cc1cca0 100644 --- a/ui/base/cocoa/hover_image_button_unittest.mm +++ b/ui/base/cocoa/hover_image_button_unittest.mm @@ -4,7 +4,7 @@ #import "ui/base/cocoa/hover_image_button.h" -#import "base/memory/scoped_nsobject.h" +#import "base/mac/scoped_nsobject.h" #import "ui/base/test/ui_cocoa_test_helper.h" namespace { @@ -13,7 +13,7 @@ class HoverImageButtonTest : public ui::CocoaTest { public: HoverImageButtonTest() { NSRect content_frame = [[test_window() contentView] frame]; - scoped_nsobject<HoverImageButton> button( + base::scoped_nsobject<HoverImageButton> button( [[HoverImageButton alloc] initWithFrame:content_frame]); button_ = button.get(); [[test_window() contentView] addSubview:button_]; diff --git a/ui/base/cocoa/menu_controller.h b/ui/base/cocoa/menu_controller.h index 19ccea2..a856404 100644 --- a/ui/base/cocoa/menu_controller.h +++ b/ui/base/cocoa/menu_controller.h @@ -7,7 +7,7 @@ #import <Cocoa/Cocoa.h> -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "base/strings/string16.h" #include "ui/base/ui_export.h" @@ -25,7 +25,7 @@ UI_EXPORT @interface MenuController : NSObject<NSMenuDelegate> { @protected ui::MenuModel* model_; // weak - scoped_nsobject<NSMenu> menu_; + base::scoped_nsobject<NSMenu> menu_; BOOL useWithPopUpButtonCell_; // If YES, 0th item is blank BOOL isMenuOpen_; } diff --git a/ui/base/cocoa/menu_controller.mm b/ui/base/cocoa/menu_controller.mm index cacb9b2..11792849 100644 --- a/ui/base/cocoa/menu_controller.mm +++ b/ui/base/cocoa/menu_controller.mm @@ -107,7 +107,7 @@ label16 = [MenuController elideMenuTitle:label16 toWidth:maxWidth]; NSString* label = l10n_util::FixUpWindowsStyleLabel(label16); - scoped_nsobject<NSMenuItem> item( + base::scoped_nsobject<NSMenuItem> item( [[NSMenuItem alloc] initWithTitle:label action:@selector(itemSelected:) keyEquivalent:@""]); @@ -184,7 +184,7 @@ NSDictionary *attributes = [NSDictionary dictionaryWithObject:font->GetNativeFont() forKey:NSFontAttributeName]; - scoped_nsobject<NSAttributedString> title( + base::scoped_nsobject<NSAttributedString> title( [[NSAttributedString alloc] initWithString:[(id)item title] attributes:attributes]); [(id)item setAttributedTitle:title.get()]; @@ -217,7 +217,7 @@ // complicate creation logic, and since the tags are model indexes, they // are unaffected by the extra item. if (useWithPopUpButtonCell_) { - scoped_nsobject<NSMenuItem> blankItem( + base::scoped_nsobject<NSMenuItem> blankItem( [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]); [menu_ insertItem:blankItem atIndex:0]; } diff --git a/ui/base/cocoa/menu_controller_unittest.mm b/ui/base/cocoa/menu_controller_unittest.mm index 507f5fe..f4cdf0f 100644 --- a/ui/base/cocoa/menu_controller_unittest.mm +++ b/ui/base/cocoa/menu_controller_unittest.mm @@ -130,7 +130,7 @@ class FontMenuModel : public SimpleMenuModel { TEST_F(MenuControllerTest, EmptyMenu) { Delegate delegate; SimpleMenuModel model(&delegate); - scoped_nsobject<MenuController> menu( + base::scoped_nsobject<MenuController> menu( [[MenuController alloc] initWithModel:&model useWithPopUpButtonCell:NO]); EXPECT_EQ([[menu menu] numberOfItems], 0); } @@ -145,7 +145,7 @@ TEST_F(MenuControllerTest, BasicCreation) { model.AddItem(4, ASCIIToUTF16("four")); model.AddItem(5, ASCIIToUTF16("five")); - scoped_nsobject<MenuController> menu( + base::scoped_nsobject<MenuController> menu( [[MenuController alloc] initWithModel:&model useWithPopUpButtonCell:NO]); EXPECT_EQ([[menu menu] numberOfItems], 6); @@ -171,7 +171,7 @@ TEST_F(MenuControllerTest, Submenus) { model.AddSubMenuWithStringId(5, kTestLabelResourceId, &submodel); model.AddItem(6, ASCIIToUTF16("three")); - scoped_nsobject<MenuController> menu( + base::scoped_nsobject<MenuController> menu( [[MenuController alloc] initWithModel:&model useWithPopUpButtonCell:NO]); EXPECT_EQ([[menu menu] numberOfItems], 3); @@ -204,7 +204,7 @@ TEST_F(MenuControllerTest, EmptySubmenu) { SimpleMenuModel submodel(&delegate); model.AddSubMenuWithStringId(2, kTestLabelResourceId, &submodel); - scoped_nsobject<MenuController> menu( + base::scoped_nsobject<MenuController> menu( [[MenuController alloc] initWithModel:&model useWithPopUpButtonCell:NO]); EXPECT_EQ([[menu menu] numberOfItems], 2); } @@ -218,7 +218,7 @@ TEST_F(MenuControllerTest, PopUpButton) { // Menu should have an extra item inserted at position 0 that has an empty // title. - scoped_nsobject<MenuController> menu( + base::scoped_nsobject<MenuController> menu( [[MenuController alloc] initWithModel:&model useWithPopUpButtonCell:YES]); EXPECT_EQ([[menu menu] numberOfItems], 4); EXPECT_EQ(base::SysNSStringToUTF16([[[menu menu] itemAtIndex:0] title]), @@ -233,7 +233,7 @@ TEST_F(MenuControllerTest, Execute) { Delegate delegate; SimpleMenuModel model(&delegate); model.AddItem(1, ASCIIToUTF16("one")); - scoped_nsobject<MenuController> menu( + base::scoped_nsobject<MenuController> menu( [[MenuController alloc] initWithModel:&model useWithPopUpButtonCell:NO]); EXPECT_EQ([[menu menu] numberOfItems], 1); @@ -262,7 +262,7 @@ TEST_F(MenuControllerTest, Validate) { submodel.AddItem(2, ASCIIToUTF16("sub-one")); model.AddSubMenuWithStringId(3, kTestLabelResourceId, &submodel); - scoped_nsobject<MenuController> menu( + base::scoped_nsobject<MenuController> menu( [[MenuController alloc] initWithModel:&model useWithPopUpButtonCell:NO]); EXPECT_EQ([[menu menu] numberOfItems], 3); @@ -277,7 +277,7 @@ TEST_F(MenuControllerTest, LabelFont) { model.AddItem(1, ASCIIToUTF16("one")); model.AddItem(2, ASCIIToUTF16("two")); - scoped_nsobject<MenuController> menu( + base::scoped_nsobject<MenuController> menu( [[MenuController alloc] initWithModel:&model useWithPopUpButtonCell:NO]); EXPECT_EQ([[menu menu] numberOfItems], 2); @@ -294,7 +294,7 @@ TEST_F(MenuControllerTest, DefaultInitializer) { model.AddItem(2, ASCIIToUTF16("two")); model.AddItem(3, ASCIIToUTF16("three")); - scoped_nsobject<MenuController> menu([[MenuController alloc] init]); + base::scoped_nsobject<MenuController> menu([[MenuController alloc] init]); EXPECT_FALSE([menu menu]); [menu setModel:&model]; @@ -317,7 +317,7 @@ TEST_F(MenuControllerTest, Dynamic) { delegate.SetDynamicLabel(initial); SimpleMenuModel model(&delegate); model.AddItem(1, ASCIIToUTF16("foo")); - scoped_nsobject<MenuController> menu( + base::scoped_nsobject<MenuController> menu( [[MenuController alloc] initWithModel:&model useWithPopUpButtonCell:NO]); EXPECT_EQ([[menu menu] numberOfItems], 1); // Validate() simulates opening the menu - the item label/icon should be @@ -359,7 +359,7 @@ TEST_F(MenuControllerTest, OpenClose) { model.AddItem(3, ASCIIToUTF16("bf")); // Create the controller. - scoped_nsobject<MenuController> menu( + base::scoped_nsobject<MenuController> menu( [[MenuController alloc] initWithModel:&model useWithPopUpButtonCell:NO]); delegate.menu_to_close_ = [menu menu]; diff --git a/ui/base/cocoa/nib_loading.mm b/ui/base/cocoa/nib_loading.mm index 9430a76..dd0eb48 100644 --- a/ui/base/cocoa/nib_loading.mm +++ b/ui/base/cocoa/nib_loading.mm @@ -5,12 +5,12 @@ #import "ui/base/cocoa/nib_loading.h" #include "base/mac/bundle_locations.h" -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" namespace ui { NSView* GetViewFromNib(NSString* name) { - scoped_nsobject<NSNib> nib( + base::scoped_nsobject<NSNib> nib( [[NSNib alloc] initWithNibNamed:name bundle:base::mac::FrameworkBundle()]); if (!nib) diff --git a/ui/base/cocoa/nsgraphics_context_additions_unittest.mm b/ui/base/cocoa/nsgraphics_context_additions_unittest.mm index 6c69b85..d4e958e 100644 --- a/ui/base/cocoa/nsgraphics_context_additions_unittest.mm +++ b/ui/base/cocoa/nsgraphics_context_additions_unittest.mm @@ -4,7 +4,7 @@ #import "ui/base/cocoa/nsgraphics_context_additions.h" -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #import "ui/base/test/ui_cocoa_test_helper.h" typedef ui::CocoaTest NSGraphicsContextCrAdditionsTest; @@ -12,7 +12,7 @@ typedef ui::CocoaTest NSGraphicsContextCrAdditionsTest; // Test fails, see http://crbug.com/249241 TEST_F(NSGraphicsContextCrAdditionsTest, DISABLED_PatternPhase) { NSRect frame = NSMakeRect(50, 50, 100, 100); - scoped_nsobject<NSView> view([[NSView alloc] initWithFrame:frame]); + base::scoped_nsobject<NSView> view([[NSView alloc] initWithFrame:frame]); [[test_window() contentView] addSubview:view]; [view lockFocus]; diff --git a/ui/base/cocoa/tracking_area.h b/ui/base/cocoa/tracking_area.h index 2800bc2..782cdae 100644 --- a/ui/base/cocoa/tracking_area.h +++ b/ui/base/cocoa/tracking_area.h @@ -7,7 +7,7 @@ #import <AppKit/AppKit.h> -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "ui/base/ui_export.h" @class CrTrackingAreaOwnerProxy; @@ -17,7 +17,7 @@ UI_EXPORT @interface CrTrackingArea : NSTrackingArea { @private - scoped_nsobject<CrTrackingAreaOwnerProxy> ownerProxy_; + base::scoped_nsobject<CrTrackingAreaOwnerProxy> ownerProxy_; } // Designated initializer. Forwards all arguments to the superclass, but wraps @@ -56,7 +56,7 @@ class UI_EXPORT ScopedCrTrackingArea { CrTrackingArea* get() const; private: - scoped_nsobject<CrTrackingArea> tracking_area_; + base::scoped_nsobject<CrTrackingArea> tracking_area_; DISALLOW_COPY_AND_ASSIGN(ScopedCrTrackingArea); }; diff --git a/ui/base/cocoa/tracking_area.mm b/ui/base/cocoa/tracking_area.mm index 474d120..a137794 100644 --- a/ui/base/cocoa/tracking_area.mm +++ b/ui/base/cocoa/tracking_area.mm @@ -71,7 +71,7 @@ options:(NSTrackingAreaOptions)options owner:(id)owner userInfo:(NSDictionary*)userInfo { - scoped_nsobject<CrTrackingAreaOwnerProxy> ownerProxy( + base::scoped_nsobject<CrTrackingAreaOwnerProxy> ownerProxy( [[CrTrackingAreaOwnerProxy alloc] initWithOwner:owner]); if ((self = [super initWithRect:rect options:options diff --git a/ui/base/cocoa/tracking_area_unittest.mm b/ui/base/cocoa/tracking_area_unittest.mm index 487aa89..b12c9d4 100644 --- a/ui/base/cocoa/tracking_area_unittest.mm +++ b/ui/base/cocoa/tracking_area_unittest.mm @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #import "ui/base/cocoa/tracking_area.h" #import "ui/base/test/ui_cocoa_test_helper.h" @@ -35,8 +35,8 @@ class CrTrackingAreaTest : public CocoaTest { userInfo:nil]) { } - scoped_nsobject<TestTrackingAreaOwner> owner_; - scoped_nsobject<CrTrackingArea> trackingArea_; + base::scoped_nsobject<TestTrackingAreaOwner> owner_; + base::scoped_nsobject<CrTrackingArea> trackingArea_; }; TEST_F(CrTrackingAreaTest, OwnerForwards) { diff --git a/ui/base/cocoa/underlay_opengl_hosting_window.mm b/ui/base/cocoa/underlay_opengl_hosting_window.mm index 3069bd2..1e562e2 100644 --- a/ui/base/cocoa/underlay_opengl_hosting_window.mm +++ b/ui/base/cocoa/underlay_opengl_hosting_window.mm @@ -9,7 +9,7 @@ #include "base/logging.h" #include "base/mac/mac_util.h" #include "base/mac/scoped_nsautorelease_pool.h" -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" @interface NSWindow (UndocumentedAPI) // Normally, punching a hole in a window by painting a subview with a @@ -121,17 +121,21 @@ NSComparisonResult OpaqueViewsOnTop(id view1, id view2, void* context) { const CGFloat kTopEdgeInset = 16; const CGFloat kAlphaValueJustOpaqueEnough = 0.005; - scoped_nsobject<NSView> leftOpaque([[OpaqueView alloc] initWithFrame: - NSMakeRect(NSMinX(rootBounds), NSMinY(rootBounds), - 1, NSHeight(rootBounds) - kTopEdgeInset)]); + base::scoped_nsobject<NSView> leftOpaque([[OpaqueView alloc] + initWithFrame:NSMakeRect(NSMinX(rootBounds), + NSMinY(rootBounds), + 1, + NSHeight(rootBounds) - kTopEdgeInset)]); [leftOpaque setAutoresizingMask:NSViewMaxXMargin | NSViewHeightSizable]; [leftOpaque setAlphaValue:kAlphaValueJustOpaqueEnough]; [rootView addSubview:leftOpaque]; - scoped_nsobject<NSView> rightOpaque([[OpaqueView alloc] initWithFrame: - NSMakeRect(NSMaxX(rootBounds) - 1, NSMinY(rootBounds), - 1, NSHeight(rootBounds) - kTopEdgeInset)]); + base::scoped_nsobject<NSView> rightOpaque([[OpaqueView alloc] + initWithFrame:NSMakeRect(NSMaxX(rootBounds) - 1, + NSMinY(rootBounds), + 1, + NSHeight(rootBounds) - kTopEdgeInset)]); [rightOpaque setAutoresizingMask:NSViewMinXMargin | NSViewHeightSizable]; [rightOpaque setAlphaValue:kAlphaValueJustOpaqueEnough]; diff --git a/ui/base/resource/resource_bundle_ios.mm b/ui/base/resource/resource_bundle_ios.mm index d9f1fb5..e054802 100644 --- a/ui/base/resource/resource_bundle_ios.mm +++ b/ui/base/resource/resource_bundle_ios.mm @@ -12,10 +12,10 @@ #include "base/files/file_path.h" #include "base/mac/bundle_locations.h" #include "base/mac/foundation_util.h" +#include "base/mac/scoped_nsobject.h" #include "base/memory/ref_counted_memory.h" -#include "base/memory/scoped_nsobject.h" -#include "base/synchronization/lock.h" #include "base/strings/sys_string_conversions.h" +#include "base/synchronization/lock.h" #include "ui/base/resource/resource_handle.h" #include "ui/gfx/image/image.h" @@ -120,14 +120,14 @@ gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { } // Create a data object from the raw bytes. - scoped_nsobject<NSData> ns_data( + base::scoped_nsobject<NSData> ns_data( [[NSData alloc] initWithBytes:data->front() length:data->size()]); bool is_fallback = PNGContainsFallbackMarker(data->front(), data->size()); // Create the image from the data. CGFloat target_scale = ui::GetScaleFactorScale(scale_factor); CGFloat source_scale = is_fallback ? 1.0 : target_scale; - scoped_nsobject<UIImage> ui_image( + base::scoped_nsobject<UIImage> ui_image( [[UIImage alloc] initWithData:ns_data scale:source_scale]); // If the image is a 1x fallback, scale it up to a full-size representation. diff --git a/ui/base/resource/resource_bundle_mac.mm b/ui/base/resource/resource_bundle_mac.mm index 28e1ee8..79f834f 100644 --- a/ui/base/resource/resource_bundle_mac.mm +++ b/ui/base/resource/resource_bundle_mac.mm @@ -11,8 +11,8 @@ #include "base/files/file_path.h" #include "base/mac/bundle_locations.h" #include "base/mac/mac_util.h" +#include "base/mac/scoped_nsobject.h" #include "base/memory/ref_counted_memory.h" -#include "base/memory/scoped_nsobject.h" #include "base/strings/sys_string_conversions.h" #include "base/synchronization/lock.h" #include "ui/base/resource/resource_handle.h" @@ -119,16 +119,15 @@ gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { image = delegate_->GetNativeImageNamed(resource_id, rtl); if (image.IsEmpty()) { - scoped_nsobject<NSImage> ns_image; + base::scoped_nsobject<NSImage> ns_image; for (size_t i = 0; i < data_packs_.size(); ++i) { scoped_refptr<base::RefCountedStaticMemory> data( data_packs_[i]->GetStaticMemory(resource_id)); if (!data.get()) continue; - scoped_nsobject<NSData> ns_data( - [[NSData alloc] initWithBytes:data->front() - length:data->size()]); + base::scoped_nsobject<NSData> ns_data( + [[NSData alloc] initWithBytes:data->front() length:data->size()]); if (!ns_image.get()) { ns_image.reset([[NSImage alloc] initWithData:ns_data]); } else { diff --git a/ui/base/test/ui_cocoa_test_helper.h b/ui/base/test/ui_cocoa_test_helper.h index ff24a2f..79e37e2 100644 --- a/ui/base/test/ui_cocoa_test_helper.h +++ b/ui/base/test/ui_cocoa_test_helper.h @@ -106,15 +106,15 @@ class CocoaTest : public PlatformTest { // displaying the view to make sure it won't crash, as well as removing it // from a window. All tests that work with NSView subclasses and/or // NSViewController subclasses should use it. -#define TEST_VIEW(test_fixture, test_view) \ +#define TEST_VIEW(test_fixture, test_view) \ TEST_F(test_fixture, test_fixture##_TestViewMacroAddRemove) { \ - scoped_nsobject<NSView> view([test_view retain]); \ - EXPECT_EQ([test_window() contentView], [view superview]); \ - [view removeFromSuperview]; \ - EXPECT_FALSE([view superview]); \ - } \ - TEST_F(test_fixture, test_fixture##_TestViewMacroDisplay) { \ - [test_view display]; \ + base::scoped_nsobject<NSView> view([test_view retain]); \ + EXPECT_EQ([test_window() contentView], [view superview]); \ + [view removeFromSuperview]; \ + EXPECT_FALSE([view superview]); \ + } \ + TEST_F(test_fixture, test_fixture##_TestViewMacroDisplay) { \ + [test_view display]; \ } // A macro which determines the proper float epsilon for a CGFloat. diff --git a/ui/compositor/test/test_compositor_host_mac.mm b/ui/compositor/test/test_compositor_host_mac.mm index 02c3ed6..3debc02 100644 --- a/ui/compositor/test/test_compositor_host_mac.mm +++ b/ui/compositor/test/test_compositor_host_mac.mm @@ -11,7 +11,7 @@ #import <Foundation/NSAutoreleasePool.h> #include "base/compiler_specific.h" -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "base/memory/scoped_ptr.h" #include "ui/compositor/compositor.h" #include "ui/gfx/rect.h" @@ -126,7 +126,8 @@ void TestCompositorHostMac::Show() { styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]; - scoped_nsobject<AcceleratedTestView> view([[AcceleratedTestView alloc] init]); + base::scoped_nsobject<AcceleratedTestView> view( + [[AcceleratedTestView alloc] init]); compositor_.reset(new ui::Compositor(this, view, bounds_.size())); [view setCompositor:compositor_.get()]; [window_ setContentView:view]; diff --git a/ui/gfx/image/image_ios.mm b/ui/gfx/image/image_ios.mm index e2ff8dc..01a3c87 100644 --- a/ui/gfx/image/image_ios.mm +++ b/ui/gfx/image/image_ios.mm @@ -4,13 +4,13 @@ #include "ui/gfx/image/image.h" +#import <UIKit/UIKit.h> #include <cmath> #include <limits> -#import <UIKit/UIKit.h> #include "base/logging.h" #include "base/mac/scoped_cftyperef.h" -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "ui/base/layout.h" #include "ui/gfx/image/image_png_rep.h" #include "ui/gfx/image/image_skia.h" @@ -117,8 +117,8 @@ ImageSkia* ImageSkiaFromPNG( // through UIImage. gfx::ImageSkia* image_skia = new gfx::ImageSkia(); for (size_t i = 0; i < image_png_reps.size(); ++i) { - scoped_nsobject<UIImage> uiimage(CreateUIImageFromImagePNGRep( - image_png_reps[i])); + base::scoped_nsobject<UIImage> uiimage( + CreateUIImageFromImagePNGRep(image_png_reps[i])); gfx::ImageSkiaRep image_skia_rep = ImageSkiaRepOfScaleFactorFromUIImage( uiimage, image_png_reps[i].scale_factor); if (!image_skia_rep.is_null()) diff --git a/ui/gfx/image/image_mac.mm b/ui/gfx/image/image_mac.mm index 0158521..d03b48e 100644 --- a/ui/gfx/image/image_mac.mm +++ b/ui/gfx/image/image_mac.mm @@ -7,7 +7,7 @@ #import <AppKit/AppKit.h> #include "base/logging.h" -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "ui/gfx/image/image_png_rep.h" #include "ui/gfx/size.h" @@ -36,7 +36,7 @@ scoped_refptr<base::RefCountedMemory> Get1xPNGBytesFromNSImage( CGImageRef cg_image = [nsimage CGImageForProposedRect:NULL context:nil hints:nil]; - scoped_nsobject<NSBitmapImageRep> ns_bitmap( + base::scoped_nsobject<NSBitmapImageRep> ns_bitmap( [[NSBitmapImageRep alloc] initWithCGImage:cg_image]); NSData* ns_data = [ns_bitmap representationUsingType:NSPNGFileType properties:nil]; @@ -55,13 +55,13 @@ NSImage* NSImageFromPNG(const std::vector<gfx::ImagePNGRep>& image_png_reps, return GetErrorNSImage(); } - scoped_nsobject<NSImage> image; + base::scoped_nsobject<NSImage> image; for (size_t i = 0; i < image_png_reps.size(); ++i) { scoped_refptr<base::RefCountedMemory> png = image_png_reps[i].raw_data; CHECK(png.get()); - scoped_nsobject<NSData> ns_data( + base::scoped_nsobject<NSData> ns_data( [[NSData alloc] initWithBytes:png->front() length:png->size()]); - scoped_nsobject<NSBitmapImageRep> ns_image_rep( + base::scoped_nsobject<NSBitmapImageRep> ns_image_rep( [[NSBitmapImageRep alloc] initWithData:ns_data]); if (!ns_image_rep) { LOG(ERROR) << "Unable to decode PNG at " @@ -78,7 +78,7 @@ NSImage* NSImageFromPNG(const std::vector<gfx::ImagePNGRep>& image_png_reps, [[ns_image_rep colorSpace] CGColorSpace]); CGColorSpaceModel color_space_model = CGColorSpaceGetModel(color_space); if (decoded_color_space_model == color_space_model) { - scoped_nsobject<NSColorSpace> ns_color_space( + base::scoped_nsobject<NSColorSpace> ns_color_space( [[NSColorSpace alloc] initWithCGColorSpace:color_space]); NSBitmapImageRep* ns_retagged_image_rep = [ns_image_rep diff --git a/ui/gfx/image/image_mac_unittest.mm b/ui/gfx/image/image_mac_unittest.mm index 7a0c3eb..250deeb 100644 --- a/ui/gfx/image/image_mac_unittest.mm +++ b/ui/gfx/image/image_mac_unittest.mm @@ -5,7 +5,7 @@ #include <Cocoa/Cocoa.h> #include "base/logging.h" -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gfx/image/image.h" #include "ui/gfx/image/image_png_rep.h" @@ -99,7 +99,7 @@ TEST_F(ImageMacTest, MultiResolutionNSImageToImageSkia) { BitmapImageRep(kWidth1x, kHeight1x, &ns_image_rep1); NSBitmapImageRep* ns_image_rep2; BitmapImageRep(kWidth2x, kHeight2x, &ns_image_rep2); - scoped_nsobject<NSImage> ns_image( + base::scoped_nsobject<NSImage> ns_image( [[NSImage alloc] initWithSize:NSMakeSize(kWidth1x, kHeight1x)]); [ns_image addRepresentation:ns_image_rep1]; [ns_image addRepresentation:ns_image_rep2]; @@ -131,7 +131,7 @@ TEST_F(ImageMacTest, UnalignedMultiResolutionNSImageToImageSkia) { NSBitmapImageRep* ns_image_rep4; BitmapImageRep(kWidth4x, kHeight4x, &ns_image_rep4); - scoped_nsobject<NSImage> ns_image( + base::scoped_nsobject<NSImage> ns_image( [[NSImage alloc] initWithSize:NSMakeSize(kWidth1x, kHeight1x)]); [ns_image addRepresentation:ns_image_rep4]; diff --git a/ui/gfx/image/image_skia_util_mac.mm b/ui/gfx/image/image_skia_util_mac.mm index 226953b..f9d0475 100644 --- a/ui/gfx/image/image_skia_util_mac.mm +++ b/ui/gfx/image/image_skia_util_mac.mm @@ -10,7 +10,7 @@ #import <AppKit/AppKit.h> #include "base/mac/mac_util.h" -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "base/memory/scoped_ptr.h" #include "skia/ext/skia_utils_mac.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -89,7 +89,7 @@ NSImage* NSImageFromImageSkia(const gfx::ImageSkia& image_skia) { if (image_skia.isNull()) return nil; - scoped_nsobject<NSImage> image([[NSImage alloc] init]); + base::scoped_nsobject<NSImage> image([[NSImage alloc] init]); image_skia.EnsureRepsForSupportedScaleFactors(); std::vector<gfx::ImageSkiaRep> image_reps = image_skia.image_reps(); for (std::vector<gfx::ImageSkiaRep>::const_iterator it = image_reps.begin(); @@ -107,7 +107,7 @@ NSImage* NSImageFromImageSkiaWithColorSpace(const gfx::ImageSkia& image_skia, if (image_skia.isNull()) return nil; - scoped_nsobject<NSImage> image([[NSImage alloc] init]); + base::scoped_nsobject<NSImage> image([[NSImage alloc] init]); image_skia.EnsureRepsForSupportedScaleFactors(); std::vector<gfx::ImageSkiaRep> image_reps = image_skia.image_reps(); for (std::vector<gfx::ImageSkiaRep>::const_iterator it = image_reps.begin(); diff --git a/ui/gfx/platform_font_mac.mm b/ui/gfx/platform_font_mac.mm index eff0c0f..bf0c0bd 100644 --- a/ui/gfx/platform_font_mac.mm +++ b/ui/gfx/platform_font_mac.mm @@ -7,7 +7,7 @@ #include <Cocoa/Cocoa.h> #include "base/basictypes.h" -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" #include "ui/gfx/canvas.h" @@ -124,7 +124,7 @@ void PlatformFontMac::InitWithNameSizeAndStyle(const std::string& font_name, void PlatformFontMac::CalculateMetrics() { NSFont* font = GetNativeFont(); - scoped_nsobject<NSLayoutManager> layout_manager( + base::scoped_nsobject<NSLayoutManager> layout_manager( [[NSLayoutManager alloc] init]); height_ = [layout_manager defaultLineHeightForFont:font]; ascent_ = [font ascender]; diff --git a/ui/gl/gl_context_nsview.h b/ui/gl/gl_context_nsview.h index f4f4df7..5f90738 100644 --- a/ui/gl/gl_context_nsview.h +++ b/ui/gl/gl_context_nsview.h @@ -8,7 +8,7 @@ #import <AppKit/NSOpenGL.h> #include "base/compiler_specific.h" -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "ui/gl/gl_context.h" namespace gfx { @@ -36,7 +36,7 @@ class GLContextNSView : public GLContextReal { void FlushBuffer(); private: - scoped_nsobject<NSOpenGLContext> context_; + base::scoped_nsobject<NSOpenGLContext> context_; GpuPreference gpu_preference_; DISALLOW_COPY_AND_ASSIGN(GLContextNSView); diff --git a/ui/gl/gl_context_nsview.mm b/ui/gl/gl_context_nsview.mm index 464ca3e..b6146bb 100644 --- a/ui/gl/gl_context_nsview.mm +++ b/ui/gl/gl_context_nsview.mm @@ -32,7 +32,7 @@ bool GLContextNSView::Initialize(GLSurface* surface, attributes.push_back(NSOpenGLPFADoubleBuffer); attributes.push_back(0); - scoped_nsobject<NSOpenGLPixelFormat> pixel_format; + base::scoped_nsobject<NSOpenGLPixelFormat> pixel_format; pixel_format.reset([[NSOpenGLPixelFormat alloc] initWithAttributes:&attributes.front()]); if (!pixel_format) { diff --git a/ui/message_center/cocoa/notification_controller.h b/ui/message_center/cocoa/notification_controller.h index 46965a7..0d3bc9d 100644 --- a/ui/message_center/cocoa/notification_controller.h +++ b/ui/message_center/cocoa/notification_controller.h @@ -9,7 +9,7 @@ #include <string> -#import "base/memory/scoped_nsobject.h" +#import "base/mac/scoped_nsobject.h" #include "ui/message_center/message_center_export.h" namespace message_center { @@ -35,22 +35,22 @@ MESSAGE_CENTER_EXPORT message_center::MessageCenter* messageCenter_; // The button that invokes |-close:|, in the upper-right corner. - scoped_nsobject<HoverImageButton> closeButton_; + base::scoped_nsobject<HoverImageButton> closeButton_; // The large icon associated with the notification, on the left side. - scoped_nsobject<NSImageView> icon_; + base::scoped_nsobject<NSImageView> icon_; // The title of the message. - scoped_nsobject<NSTextField> title_; + base::scoped_nsobject<NSTextField> title_; // Body text of the message. - scoped_nsobject<NSTextField> message_; + base::scoped_nsobject<NSTextField> message_; // Container for optional list item views. - scoped_nsobject<NSView> listItemView_; + base::scoped_nsobject<NSView> listItemView_; // Container for optional items at the bottom of the notification. - scoped_nsobject<NSView> bottomView_; + base::scoped_nsobject<NSView> bottomView_; } // Creates a new controller for a given notification. diff --git a/ui/message_center/cocoa/notification_controller.mm b/ui/message_center/cocoa/notification_controller.mm index 87b4a8f..afea9e6 100644 --- a/ui/message_center/cocoa/notification_controller.mm +++ b/ui/message_center/cocoa/notification_controller.mm @@ -207,9 +207,8 @@ NSRect rootFrame = NSMakeRect(0, 0, message_center::kNotificationPreferredImageSize, message_center::kNotificationIconSize); - scoped_nsobject<MCNotificationView> rootView( - [[MCNotificationView alloc] initWithController:self - frame:rootFrame]); + base::scoped_nsobject<MCNotificationView> rootView( + [[MCNotificationView alloc] initWithController:self frame:rootFrame]); [self configureCustomBox:rootView]; [rootView setFillColor:gfx::SkColorToCalibratedNSColor( message_center::kNotificationBackgroundColor)]; @@ -346,9 +345,9 @@ NSRect buttonFrame = frame; buttonFrame.origin = NSMakePoint(0, y); buttonFrame.size.height = message_center::kButtonHeight; - scoped_nsobject<NSButton> button( + base::scoped_nsobject<NSButton> button( [[NSButton alloc] initWithFrame:buttonFrame]); - scoped_nsobject<MCNotificationButtonCell> cell( + base::scoped_nsobject<MCNotificationButtonCell> cell( [[MCNotificationButtonCell alloc] initTextCell:base::SysUTF16ToNSString(buttonInfo.title)]); [cell setShowsBorderOnlyWhileMouseInside:YES]; @@ -366,7 +365,7 @@ NSRect separatorFrame = frame; separatorFrame.origin = NSMakePoint(0, y); separatorFrame.size.height = 1; - scoped_nsobject<NSBox> separator( + base::scoped_nsobject<NSBox> separator( [[AccessibilityIgnoredBox alloc] initWithFrame:separatorFrame]); [self configureCustomBox:separator]; [separator setFillColor:gfx::SkColorToCalibratedNSColor( @@ -383,7 +382,7 @@ imageFrame.origin = NSMakePoint(0, y); imageFrame.size = NSSizeFromCGSize(message_center::GetImageSizeForWidth( NSWidth(frame), notification->image().Size()).ToCGSize()); - scoped_nsobject<NSImageView> imageView( + base::scoped_nsobject<NSImageView> imageView( [[NSImageView alloc] initWithFrame:imageFrame]); [imageView setImage:image]; [imageView setImageScaling:NSImageScaleProportionallyUpOrDown]; @@ -440,7 +439,7 @@ NSMutableAttributedString* formattedText = [[[NSMutableAttributedString alloc] initWithString:text] autorelease]; - scoped_nsobject<NSMutableParagraphStyle> paragraphStyle( + base::scoped_nsobject<NSMutableParagraphStyle> paragraphStyle( [[NSParagraphStyle defaultParagraphStyle] mutableCopy]); [paragraphStyle setLineBreakMode:NSLineBreakByTruncatingTail]; NSDictionary* sharedAttribs = @{ @@ -481,7 +480,7 @@ NSRect imageFrame = NSMakeRect(0, 0, message_center::kNotificationIconSize, message_center::kNotificationIconSize); - scoped_nsobject<NSBox> imageBox( + base::scoped_nsobject<NSBox> imageBox( [[AccessibilityIgnoredBox alloc] initWithFrame:imageFrame]); [self configureCustomBox:imageBox]; [imageBox setFillColor:gfx::SkColorToCalibratedNSColor( diff --git a/ui/message_center/cocoa/notification_controller_unittest.mm b/ui/message_center/cocoa/notification_controller_unittest.mm index 219ae54..6155aff 100644 --- a/ui/message_center/cocoa/notification_controller_unittest.mm +++ b/ui/message_center/cocoa/notification_controller_unittest.mm @@ -5,7 +5,7 @@ #import "ui/message_center/cocoa/notification_controller.h" #include "base/mac/foundation_util.h" -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "base/memory/scoped_ptr.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" @@ -110,7 +110,7 @@ TEST_F(NotificationControllerTest, BasicLayout) { NULL)); notification->set_icon(gfx::Image([TestIcon() retain])); - scoped_nsobject<MCNotificationController> controller( + base::scoped_nsobject<MCNotificationController> controller( [[MCNotificationController alloc] initWithNotification:notification.get() messageCenter:NULL]); [controller view]; @@ -138,7 +138,7 @@ TEST_F(NotificationControllerTest, OverflowText) { std::string(), message_center::RichNotificationData(), NULL)); - scoped_nsobject<MCNotificationController> controller( + base::scoped_nsobject<MCNotificationController> controller( [[MCNotificationController alloc] initWithNotification:notification.get() messageCenter:NULL]); [controller view]; @@ -161,7 +161,7 @@ TEST_F(NotificationControllerTest, Close) { NULL)); MockMessageCenter message_center; - scoped_nsobject<MCNotificationController> controller( + base::scoped_nsobject<MCNotificationController> controller( [[MCNotificationController alloc] initWithNotification:notification.get() messageCenter:&message_center]); [controller view]; @@ -186,7 +186,7 @@ TEST_F(NotificationControllerTest, Update) { std::string(), message_center::RichNotificationData(), NULL)); - scoped_nsobject<MCNotificationController> controller( + base::scoped_nsobject<MCNotificationController> controller( [[MCNotificationController alloc] initWithNotification:notification.get() messageCenter:NULL]); @@ -224,7 +224,7 @@ TEST_F(NotificationControllerTest, Buttons) { NULL)); MockMessageCenter message_center; - scoped_nsobject<MCNotificationController> controller( + base::scoped_nsobject<MCNotificationController> controller( [[MCNotificationController alloc] initWithNotification:notification.get() messageCenter:&message_center]); [controller view]; @@ -252,7 +252,7 @@ TEST_F(NotificationControllerTest, Image) { MockMessageCenter message_center; - scoped_nsobject<MCNotificationController> controller( + base::scoped_nsobject<MCNotificationController> controller( [[MCNotificationController alloc] initWithNotification:notification.get() messageCenter:&message_center]); [controller view]; @@ -286,7 +286,7 @@ TEST_F(NotificationControllerTest, List) { NULL)); MockMessageCenter message_center; - scoped_nsobject<MCNotificationController> controller( + base::scoped_nsobject<MCNotificationController> controller( [[MCNotificationController alloc] initWithNotification:notification.get() messageCenter:&message_center]); [controller view]; diff --git a/ui/message_center/cocoa/popup_collection.h b/ui/message_center/cocoa/popup_collection.h index af06bf5e..806114b 100644 --- a/ui/message_center/cocoa/popup_collection.h +++ b/ui/message_center/cocoa/popup_collection.h @@ -10,7 +10,7 @@ #include <set> #include "base/mac/scoped_block.h" -#import "base/memory/scoped_nsobject.h" +#import "base/mac/scoped_nsobject.h" #import "base/memory/scoped_ptr.h" #include "ui/message_center/message_center_export.h" @@ -37,11 +37,11 @@ MESSAGE_CENTER_EXPORT scoped_ptr<message_center::MessageCenterObserver> observer_; // Array of all on-screen popup notifications. - scoped_nsobject<NSMutableArray> popups_; + base::scoped_nsobject<NSMutableArray> popups_; // Array of all on-screen popup notifications that are being faded out // for removal. - scoped_nsobject<NSMutableArray> popupsBeingRemoved_; + base::scoped_nsobject<NSMutableArray> popupsBeingRemoved_; // For testing only. If not a zero rect, this is the screen size to use // for laying out popups. diff --git a/ui/message_center/cocoa/popup_collection_unittest.mm b/ui/message_center/cocoa/popup_collection_unittest.mm index 2375d03..36876ac 100644 --- a/ui/message_center/cocoa/popup_collection_unittest.mm +++ b/ui/message_center/cocoa/popup_collection_unittest.mm @@ -4,7 +4,7 @@ #import "ui/message_center/cocoa/popup_collection.h" -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" #include "base/run_loop.h" @@ -111,7 +111,7 @@ class PopupCollectionTest : public ui::CocoaTest { base::MessageLoop message_loop_; scoped_ptr<base::RunLoop> nested_run_loop_; message_center::MessageCenter* center_; - scoped_nsobject<MCPopupCollection> collection_; + base::scoped_nsobject<MCPopupCollection> collection_; }; TEST_F(PopupCollectionTest, AddThreeCloseOne) { diff --git a/ui/message_center/cocoa/popup_controller.h b/ui/message_center/cocoa/popup_controller.h index 283a463..47a052d 100644 --- a/ui/message_center/cocoa/popup_controller.h +++ b/ui/message_center/cocoa/popup_controller.h @@ -9,7 +9,7 @@ #include <string> -#import "base/memory/scoped_nsobject.h" +#import "base/mac/scoped_nsobject.h" #import "ui/base/cocoa/tracking_area.h" #include "ui/message_center/message_center_export.h" @@ -34,7 +34,7 @@ MESSAGE_CENTER_EXPORT MCPopupCollection* popupCollection_; // The view controller that provide's the popup content view. - scoped_nsobject<MCNotificationController> notificationController_; + base::scoped_nsobject<MCNotificationController> notificationController_; // If the swipe-away gesture received NSEventPhaseEnded. BOOL swipeGestureEnded_; @@ -51,7 +51,7 @@ MESSAGE_CENTER_EXPORT NSRect bounds_; // Used to play animation when the popup shows, changes bounds and closes. - scoped_nsobject<NSViewAnimation> boundsAnimation_; + base::scoped_nsobject<NSViewAnimation> boundsAnimation_; // Used to track the popup for mouse entered and exited events. ui::ScopedCrTrackingArea trackingArea_; diff --git a/ui/message_center/cocoa/popup_controller.mm b/ui/message_center/cocoa/popup_controller.mm index 496e08a..30badc7 100644 --- a/ui/message_center/cocoa/popup_controller.mm +++ b/ui/message_center/cocoa/popup_controller.mm @@ -97,12 +97,12 @@ enum { - (id)initWithNotification:(const message_center::Notification*)notification messageCenter:(message_center::MessageCenter*)messageCenter popupCollection:(MCPopupCollection*)popupCollection { - scoped_nsobject<MCPopupWindow> window( + base::scoped_nsobject<MCPopupWindow> window( [[MCPopupWindow alloc] initWithContentRect:ui::kWindowSizeDeterminedLater - styleMask:NSBorderlessWindowMask | - NSNonactivatingPanelMask - backing:NSBackingStoreBuffered - defer:YES]); + styleMask:NSBorderlessWindowMask | + NSNonactivatingPanelMask + backing:NSBackingStoreBuffered + defer:YES]); if ((self = [super initWithWindow:window])) { messageCenter_ = messageCenter; popupCollection_ = popupCollection; diff --git a/ui/message_center/cocoa/popup_controller_unittest.mm b/ui/message_center/cocoa/popup_controller_unittest.mm index f1b28e5..41f6279 100644 --- a/ui/message_center/cocoa/popup_controller_unittest.mm +++ b/ui/message_center/cocoa/popup_controller_unittest.mm @@ -4,7 +4,7 @@ #import "ui/message_center/cocoa/popup_controller.h" -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "base/memory/scoped_ptr.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" @@ -27,7 +27,7 @@ TEST_F(PopupControllerTest, Creation) { message_center::RichNotificationData(), NULL)); - scoped_nsobject<MCPopupController> controller( + base::scoped_nsobject<MCPopupController> controller( [[MCPopupController alloc] initWithNotification:notification.get() messageCenter:nil popupCollection:nil]); diff --git a/ui/message_center/cocoa/settings_controller.h b/ui/message_center/cocoa/settings_controller.h index 1ae11c7..2029f6b 100644 --- a/ui/message_center/cocoa/settings_controller.h +++ b/ui/message_center/cocoa/settings_controller.h @@ -7,7 +7,7 @@ #import <Cocoa/Cocoa.h> -#import "base/memory/scoped_nsobject.h" +#import "base/mac/scoped_nsobject.h" #include "base/memory/scoped_ptr.h" #include "ui/message_center/message_center_export.h" #include "ui/message_center/notifier_settings.h" @@ -45,13 +45,13 @@ MESSAGE_CENTER_EXPORT message_center::NotifierSettingsProvider* provider_; // The "Settings" text at the top. - scoped_nsobject<NSTextField> settingsText_; + base::scoped_nsobject<NSTextField> settingsText_; // The smaller text below the "Settings" text. - scoped_nsobject<NSTextField> detailsText_; + base::scoped_nsobject<NSTextField> detailsText_; // Container for all the checkboxes. - scoped_nsobject<NSScrollView> scrollView_; + base::scoped_nsobject<NSScrollView> scrollView_; std::vector<message_center::Notifier*> notifiers_; } diff --git a/ui/message_center/cocoa/settings_controller.mm b/ui/message_center/cocoa/settings_controller.mm index 0ae09ec..d606e72 100644 --- a/ui/message_center/cocoa/settings_controller.mm +++ b/ui/message_center/cocoa/settings_controller.mm @@ -5,14 +5,14 @@ #import "ui/message_center/cocoa/settings_controller.h" #include "base/mac/foundation_util.h" +#import "base/mac/scoped_nsobject.h" #include "base/strings/sys_string_conversions.h" #include "grit/ui_strings.h" +#include "skia/ext/skia_utils_mac.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" -#import "base/memory/scoped_nsobject.h" #import "ui/message_center/cocoa/tray_view_controller.h" #include "ui/message_center/message_center_style.h" -#include "skia/ext/skia_utils_mac.h" const int kMarginWidth = 16; const int kEntryHeight = 38; @@ -27,7 +27,7 @@ const int kCorrectedCheckmarkPadding = @interface MCSettingsButtonCell : NSButtonCell { // A checkbox's regular image is the checkmark image. This additional image // is used for the favicon or app icon shown next to the checkmark. - scoped_nsobject<NSImage> extraImage_; + base::scoped_nsobject<NSImage> extraImage_; } - (void)setExtraImage:(NSImage*)extraImage; @end @@ -150,7 +150,7 @@ void NotifierSettingsObserverMac::UpdateFavicon(const GURL& url, // Container view. NSRect fullFrame = NSMakeRect(0, 0, [MCTrayViewController trayWidth], maxHeight); - scoped_nsobject<NSBox> view([[NSBox alloc] initWithFrame:fullFrame]); + base::scoped_nsobject<NSBox> view([[NSBox alloc] initWithFrame:fullFrame]); [view setBorderType:NSNoBorder]; [view setBoxType:NSBoxCustom]; [view setContentViewMargins:NSZeroSize]; @@ -199,7 +199,7 @@ void NotifierSettingsObserverMac::UpdateFavicon(const GURL& url, // Document view for the notifier settings. CGFloat y = 0; NSRect documentFrame = NSMakeRect(0, 0, NSWidth(fullFrame), 0); - scoped_nsobject<NSView> documentView( + base::scoped_nsobject<NSView> documentView( [[NSView alloc] initWithFrame:documentFrame]); for (int i = notifiers_.size() - 1; i >= 0; --i) { message_center::Notifier* notifier = notifiers_[i]; @@ -207,8 +207,9 @@ void NotifierSettingsObserverMac::UpdateFavicon(const GURL& url, // TODO(thakis): Use a custom button cell. NSRect frame = NSMakeRect( kMarginWidth, y, NSWidth(documentFrame) - kMarginWidth, kEntryHeight); - scoped_nsobject<NSButton> button([[NSButton alloc] initWithFrame:frame]); - scoped_nsobject<MCSettingsButtonCell> cell( + base::scoped_nsobject<NSButton> button( + [[NSButton alloc] initWithFrame:frame]); + base::scoped_nsobject<MCSettingsButtonCell> cell( [[MCSettingsButtonCell alloc] initTextCell:base::SysUTF16ToNSString(notifier->name)]); [button setCell:cell]; diff --git a/ui/message_center/cocoa/settings_controller_unittest.mm b/ui/message_center/cocoa/settings_controller_unittest.mm index 037953c..ca810e6 100644 --- a/ui/message_center/cocoa/settings_controller_unittest.mm +++ b/ui/message_center/cocoa/settings_controller_unittest.mm @@ -42,7 +42,7 @@ TEST_F(CocoaTest, Basic) { FakeNotifierSettingsProvider provider(notifiers); - scoped_nsobject<MCSettingsController> controller( + base::scoped_nsobject<MCSettingsController> controller( [[MCSettingsController alloc] initWithProvider:&provider]); [controller view]; @@ -58,7 +58,7 @@ TEST_F(CocoaTest, Toggle) { FakeNotifierSettingsProvider provider(notifiers); - scoped_nsobject<MCSettingsController> controller( + base::scoped_nsobject<MCSettingsController> controller( [[MCSettingsController alloc] initWithProvider:&provider]); [controller view]; diff --git a/ui/message_center/cocoa/status_item_view.h b/ui/message_center/cocoa/status_item_view.h index 29a26eb..f317dff 100644 --- a/ui/message_center/cocoa/status_item_view.h +++ b/ui/message_center/cocoa/status_item_view.h @@ -8,7 +8,7 @@ #import <AppKit/AppKit.h> #include "base/mac/scoped_block.h" -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "ui/message_center/message_center_export.h" namespace message_center { @@ -27,7 +27,7 @@ MESSAGE_CENTER_EXPORT @interface MCStatusItemView : NSView { @private // The status item. - scoped_nsobject<NSStatusItem> statusItem_; + base::scoped_nsobject<NSStatusItem> statusItem_; // Callback issued when the status item is clicked. base::mac::ScopedBlock<message_center::StatusItemClickedCallack> callback_; diff --git a/ui/message_center/cocoa/status_item_view_unittest.mm b/ui/message_center/cocoa/status_item_view_unittest.mm index 7e9dc45..519fdd5 100644 --- a/ui/message_center/cocoa/status_item_view_unittest.mm +++ b/ui/message_center/cocoa/status_item_view_unittest.mm @@ -4,7 +4,7 @@ #import "ui/message_center/cocoa/status_item_view.h" -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #import "ui/base/test/ui_cocoa_test_helper.h" class StatusItemViewTest : public ui::CocoaTest { @@ -24,7 +24,7 @@ class StatusItemViewTest : public ui::CocoaTest { } protected: - scoped_nsobject<MCStatusItemView> view_; + base::scoped_nsobject<MCStatusItemView> view_; }; // These tests are like TEST_VIEW() but set some of the properties. diff --git a/ui/message_center/cocoa/tray_controller.h b/ui/message_center/cocoa/tray_controller.h index 50e94fa..d855cd8 100644 --- a/ui/message_center/cocoa/tray_controller.h +++ b/ui/message_center/cocoa/tray_controller.h @@ -8,7 +8,7 @@ #import <AppKit/AppKit.h> #include "base/basictypes.h" -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "ui/message_center/message_center_export.h" @class MCTrayViewController; @@ -25,7 +25,7 @@ MESSAGE_CENTER_EXPORT message_center::MessageCenterTray* tray_; // Weak, indirectly owns this. // View controller that provides this window's content. - scoped_nsobject<MCTrayViewController> viewController_; + base::scoped_nsobject<MCTrayViewController> viewController_; // An event monitor that listens for clicks outside the tray window to cause // it to close. diff --git a/ui/message_center/cocoa/tray_controller.mm b/ui/message_center/cocoa/tray_controller.mm index 33b6e7c..38ca2fd 100644 --- a/ui/message_center/cocoa/tray_controller.mm +++ b/ui/message_center/cocoa/tray_controller.mm @@ -29,7 +29,7 @@ @implementation MCTrayController - (id)initWithMessageCenterTray:(message_center::MessageCenterTray*)tray { - scoped_nsobject<MCTrayWindow> window( + base::scoped_nsobject<MCTrayWindow> window( [[MCTrayWindow alloc] initWithContentRect:ui::kWindowSizeDeterminedLater styleMask:NSBorderlessWindowMask | NSNonactivatingPanelMask diff --git a/ui/message_center/cocoa/tray_controller_unittest.mm b/ui/message_center/cocoa/tray_controller_unittest.mm index a857bf4..379c3de 100644 --- a/ui/message_center/cocoa/tray_controller_unittest.mm +++ b/ui/message_center/cocoa/tray_controller_unittest.mm @@ -4,7 +4,7 @@ #import "ui/message_center/cocoa/tray_controller.h" -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "base/memory/scoped_ptr.h" #import "ui/base/test/ui_cocoa_test_helper.h" #include "ui/message_center/message_center.h" @@ -32,7 +32,7 @@ class TrayControllerTest : public ui::CocoaTest { protected: scoped_ptr<message_center::MessageCenterTray> tray_; - scoped_nsobject<MCTrayController> controller_; + base::scoped_nsobject<MCTrayController> controller_; }; TEST_F(TrayControllerTest, OpenLeftRight) { diff --git a/ui/message_center/cocoa/tray_view_controller.h b/ui/message_center/cocoa/tray_view_controller.h index 2446e90..76ce518 100644 --- a/ui/message_center/cocoa/tray_view_controller.h +++ b/ui/message_center/cocoa/tray_view_controller.h @@ -12,7 +12,7 @@ #include <string> #include "base/mac/scoped_block.h" -#import "base/memory/scoped_nsobject.h" +#import "base/mac/scoped_nsobject.h" #include "ui/message_center/message_center_export.h" @class HoverImageButton; @@ -40,43 +40,43 @@ MESSAGE_CENTER_EXPORT message_center::MessageCenter* messageCenter_; // The back button shown while the settings are open. - scoped_nsobject<HoverImageButton> backButton_; + base::scoped_nsobject<HoverImageButton> backButton_; // The "Notifications" label at the top. - scoped_nsobject<NSTextField> title_; + base::scoped_nsobject<NSTextField> title_; // The scroll view that contains all the notifications in its documentView. - scoped_nsobject<NSScrollView> scrollView_; + base::scoped_nsobject<NSScrollView> scrollView_; // The clip view that manages how scrollView_'s documentView is clipped. - scoped_nsobject<MCClipView> clipView_; + base::scoped_nsobject<MCClipView> clipView_; // Array of MCNotificationController objects, which the array owns. - scoped_nsobject<NSMutableArray> notifications_; + base::scoped_nsobject<NSMutableArray> notifications_; // Map of notification IDs to weak pointers of the view controllers in // |notifications_|. std::map<std::string, MCNotificationController*> notificationsMap_; // The pause button that enters quiet mode. - scoped_nsobject<HoverImageButton> pauseButton_; + base::scoped_nsobject<HoverImageButton> pauseButton_; // The clear all notifications button. Hidden when there are no notifications. - scoped_nsobject<HoverImageButton> clearAllButton_; + base::scoped_nsobject<HoverImageButton> clearAllButton_; // The settings button that shows the settings UI. - scoped_nsobject<HoverImageButton> settingsButton_; + base::scoped_nsobject<HoverImageButton> settingsButton_; // Array of MCNotificationController objects pending removal by the user. // The object is owned by the array. - scoped_nsobject<NSMutableArray> notificationsPendingRemoval_; + base::scoped_nsobject<NSMutableArray> notificationsPendingRemoval_; // Used to animate multiple notifications simultaneously when they're being // removed or repositioned. - scoped_nsobject<NSViewAnimation> animation_; + base::scoped_nsobject<NSViewAnimation> animation_; // The controller of the settings view. Only set while the view is open. - scoped_nsobject<MCSettingsController> settingsController_; + base::scoped_nsobject<MCSettingsController> settingsController_; // The flag which is set when the notification removal animation is still // in progress and the user clicks "Clear All" button. The clear-all animation @@ -92,7 +92,7 @@ MESSAGE_CENTER_EXPORT std::list<MCNotificationController*> visibleNotificationsPendingClear_; // Array of NSViewAnimation objects, which the array owns. - scoped_nsobject<NSMutableArray> clearAllAnimations_; + base::scoped_nsobject<NSMutableArray> clearAllAnimations_; // The duration of the bounds animation, in the number of seconds. NSTimeInterval animationDuration_; diff --git a/ui/message_center/cocoa/tray_view_controller.mm b/ui/message_center/cocoa/tray_view_controller.mm index 1a90a96..9e0f9fa 100644 --- a/ui/message_center/cocoa/tray_view_controller.mm +++ b/ui/message_center/cocoa/tray_view_controller.mm @@ -125,7 +125,7 @@ const CGFloat kTrayBottomMargin = 75; - (void)loadView { // Configure the root view as a background-colored box. - scoped_nsobject<NSBox> view([[NSBox alloc] initWithFrame:NSMakeRect( + base::scoped_nsobject<NSBox> view([[NSBox alloc] initWithFrame:NSMakeRect( 0, 0, [MCTrayViewController trayWidth], kControlAreaHeight)]); [view setBorderType:NSNoBorder]; [view setBoxType:NSBoxCustom]; @@ -139,7 +139,7 @@ const CGFloat kTrayBottomMargin = 75; [self layoutControlArea]; // Configure the scroll view in which all the notifications go. - scoped_nsobject<NSView> documentView( + base::scoped_nsobject<NSView> documentView( [[NSView alloc] initWithFrame:NSZeroRect]); scrollView_.reset([[NSScrollView alloc] initWithFrame:[view frame]]); clipView_.reset( @@ -169,7 +169,7 @@ const CGFloat kTrayBottomMargin = 75; std::map<std::string, MCNotificationController*> newMap; - scoped_nsobject<NSShadow> shadow([[NSShadow alloc] init]); + base::scoped_nsobject<NSShadow> shadow([[NSShadow alloc] init]); [shadow setShadowColor:[NSColor colorWithDeviceWhite:0 alpha:0.55]]; [shadow setShadowOffset:NSMakeSize(0, -1)]; [shadow setShadowBlurRadius:2.0]; @@ -188,7 +188,7 @@ const CGFloat kTrayBottomMargin = 75; const auto& existing = notificationsMap_.find((*it)->id()); MCNotificationController* notification = nil; if (existing == notificationsMap_.end()) { - scoped_nsobject<MCNotificationController> controller( + base::scoped_nsobject<MCNotificationController> controller( [[MCNotificationController alloc] initWithNotification:*it messageCenter:messageCenter_]); @@ -425,7 +425,7 @@ const CGFloat kTrayBottomMargin = 75; [[self view] addSubview:backButton_]; // Create the divider line between the control area and the notifications. - scoped_nsobject<NSBox> divider( + base::scoped_nsobject<NSBox> divider( [[NSBox alloc] initWithFrame:NSMakeRect(0, 0, NSWidth([view frame]), 1)]); [divider setAutoresizingMask:NSViewMinYMargin]; [divider setBorderType:NSNoBorder]; @@ -598,7 +598,7 @@ const CGFloat kTrayBottomMargin = 75; } - (void)hideNotificationsPendingRemoval { - scoped_nsobject<NSMutableArray> animationDataArray( + base::scoped_nsobject<NSMutableArray> animationDataArray( [[NSMutableArray alloc] init]); // Fade-out those notifications pending removal. @@ -629,7 +629,7 @@ const CGFloat kTrayBottomMargin = 75; } - (void)moveUpRemainingNotifications { - scoped_nsobject<NSMutableArray> animationDataArray( + base::scoped_nsobject<NSMutableArray> animationDataArray( [[NSMutableArray alloc] init]); // Compute the position where the remaining notifications should start. @@ -705,7 +705,7 @@ const CGFloat kTrayBottomMargin = 75; NSViewAnimationEndFrameKey : [NSValue valueWithRect:newFrame], NSViewAnimationEffectKey : NSViewAnimationFadeOutEffect }; - scoped_nsobject<NSViewAnimation> animation([[NSViewAnimation alloc] + base::scoped_nsobject<NSViewAnimation> animation([[NSViewAnimation alloc] initWithViewAnimations:[NSArray arrayWithObject:animationDict]]); [animation setDuration:animationDuration_]; [animation setDelegate:self]; diff --git a/ui/message_center/cocoa/tray_view_controller_unittest.mm b/ui/message_center/cocoa/tray_view_controller_unittest.mm index 0296a7a..55a48d7 100644 --- a/ui/message_center/cocoa/tray_view_controller_unittest.mm +++ b/ui/message_center/cocoa/tray_view_controller_unittest.mm @@ -4,7 +4,7 @@ #import "ui/message_center/cocoa/tray_view_controller.h" -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "base/message_loop.h" #include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" @@ -57,7 +57,7 @@ class TrayViewControllerTest : public ui::CocoaTest { base::MessageLoop message_loop_; scoped_ptr<base::RunLoop> nested_run_loop_; - scoped_nsobject<MCTrayViewController> tray_; + base::scoped_nsobject<MCTrayViewController> tray_; }; TEST_F(TrayViewControllerTest, AddRemoveOne) { diff --git a/ui/shell_dialogs/select_file_dialog_mac.mm b/ui/shell_dialogs/select_file_dialog_mac.mm index 8893762..1511318 100644 --- a/ui/shell_dialogs/select_file_dialog_mac.mm +++ b/ui/shell_dialogs/select_file_dialog_mac.mm @@ -17,7 +17,7 @@ #include "base/mac/foundation_util.h" #include "base/mac/mac_util.h" #include "base/mac/scoped_cftyperef.h" -#import "base/memory/scoped_nsobject.h" +#import "base/mac/scoped_nsobject.h" #include "base/strings/sys_string_conversions.h" #include "base/threading/thread_restrictions.h" #include "grit/ui_strings.h" @@ -100,7 +100,7 @@ class SelectFileDialogImpl : public ui::SelectFileDialog { virtual bool HasMultipleFileTypeChoicesImpl() OVERRIDE; // The bridge for results from Cocoa to return to us. - scoped_nsobject<SelectFileDialogBridge> bridge_; + base::scoped_nsobject<SelectFileDialogBridge> bridge_; // A map from file dialogs to the |params| user data associated with them. std::map<NSSavePanel*, void*> params_map_; diff --git a/ui/snapshot/snapshot_mac.mm b/ui/snapshot/snapshot_mac.mm index 5a0c6d6..abd8728 100644 --- a/ui/snapshot/snapshot_mac.mm +++ b/ui/snapshot/snapshot_mac.mm @@ -8,7 +8,7 @@ #include "base/logging.h" #include "base/mac/scoped_cftyperef.h" -#include "base/memory/scoped_nsobject.h" +#include "base/mac/scoped_nsobject.h" #include "ui/gfx/rect.h" namespace ui { @@ -49,7 +49,7 @@ bool GrabViewSnapshot(gfx::NativeView view, if (CGImageGetWidth(windowSnapshot) <= 0) return false; - scoped_nsobject<NSBitmapImageRep> rep( + base::scoped_nsobject<NSBitmapImageRep> rep( [[NSBitmapImageRep alloc] initWithCGImage:windowSnapshot]); NSData* data = [rep representationUsingType:NSPNGFileType properties:nil]; const unsigned char* buf = static_cast<const unsigned char*>([data bytes]); diff --git a/ui/snapshot/snapshot_mac_unittest.mm b/ui/snapshot/snapshot_mac_unittest.mm index 362902e..2765792 100644 --- a/ui/snapshot/snapshot_mac_unittest.mm +++ b/ui/snapshot/snapshot_mac_unittest.mm @@ -6,8 +6,8 @@ #import <Cocoa/Cocoa.h> +#include "base/mac/scoped_nsobject.h" #include "base/mac/sdk_forward_declarations.h" -#include "base/memory/scoped_nsobject.h" #include "base/memory/scoped_ptr.h" #include "testing/platform_test.h" #include "ui/gfx/rect.h" @@ -20,7 +20,7 @@ typedef PlatformTest GrabWindowSnapshotTest; TEST_F(GrabWindowSnapshotTest, TestGrabWindowSnapshot) { // Launch a test window so we can take a snapshot. NSRect frame = NSMakeRect(0, 0, 400, 400); - scoped_nsobject<NSWindow> window( + base::scoped_nsobject<NSWindow> window( [[NSWindow alloc] initWithContentRect:frame styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered @@ -35,7 +35,7 @@ TEST_F(GrabWindowSnapshotTest, TestGrabWindowSnapshot) { bounds)); // Copy png back into NSData object so we can make sure we grabbed a png. - scoped_nsobject<NSData> image_data( + base::scoped_nsobject<NSData> image_data( [[NSData alloc] initWithBytes:&(*png_representation)[0] length:png_representation->size()]); NSBitmapImageRep* rep = [NSBitmapImageRep imageRepWithData:image_data.get()]; |