OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/extensions/browser_action_test_util.h" | 5 #include "chrome/browser/extensions/browser_action_test_util.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/mac/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ptr_util.h" |
12 #include "base/path_service.h" | 13 #include "base/path_service.h" |
13 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
14 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
15 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 16 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
16 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 17 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
17 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 18 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
18 #import "chrome/browser/ui/cocoa/extensions/browser_action_button.h" | 19 #import "chrome/browser/ui/cocoa/extensions/browser_action_button.h" |
19 #import "chrome/browser/ui/cocoa/extensions/browser_actions_container_view.h" | 20 #import "chrome/browser/ui/cocoa/extensions/browser_actions_container_view.h" |
20 #import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h" | 21 #import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h" |
21 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" | 22 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 [GetController(browser_, test_helper_.get()) containerView]; | 191 [GetController(browser_, test_helper_.get()) containerView]; |
191 NSRect frame = [containerView frame]; | 192 NSRect frame = [containerView frame]; |
192 frame.size.width = width; | 193 frame.size.width = width; |
193 [containerView setFrame:frame]; | 194 [containerView setFrame:frame]; |
194 } | 195 } |
195 | 196 |
196 ToolbarActionsBar* BrowserActionTestUtil::GetToolbarActionsBar() { | 197 ToolbarActionsBar* BrowserActionTestUtil::GetToolbarActionsBar() { |
197 return [GetController(browser_, test_helper_.get()) toolbarActionsBar]; | 198 return [GetController(browser_, test_helper_.get()) toolbarActionsBar]; |
198 } | 199 } |
199 | 200 |
200 scoped_ptr<BrowserActionTestUtil> BrowserActionTestUtil::CreateOverflowBar() { | 201 std::unique_ptr<BrowserActionTestUtil> |
| 202 BrowserActionTestUtil::CreateOverflowBar() { |
201 CHECK(!GetToolbarActionsBar()->in_overflow_mode()) | 203 CHECK(!GetToolbarActionsBar()->in_overflow_mode()) |
202 << "Only a main bar can create an overflow bar!"; | 204 << "Only a main bar can create an overflow bar!"; |
203 return make_scoped_ptr(new BrowserActionTestUtil(browser_, this)); | 205 return base::WrapUnique(new BrowserActionTestUtil(browser_, this)); |
204 } | 206 } |
205 | 207 |
206 // static | 208 // static |
207 gfx::Size BrowserActionTestUtil::GetMinPopupSize() { | 209 gfx::Size BrowserActionTestUtil::GetMinPopupSize() { |
208 return gfx::Size(NSSizeToCGSize([ExtensionPopupController minPopupSize])); | 210 return gfx::Size(NSSizeToCGSize([ExtensionPopupController minPopupSize])); |
209 } | 211 } |
210 | 212 |
211 // static | 213 // static |
212 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() { | 214 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() { |
213 return gfx::Size(NSSizeToCGSize([ExtensionPopupController maxPopupSize])); | 215 return gfx::Size(NSSizeToCGSize([ExtensionPopupController maxPopupSize])); |
214 } | 216 } |
215 | 217 |
216 BrowserActionTestUtil::BrowserActionTestUtil(Browser* browser, | 218 BrowserActionTestUtil::BrowserActionTestUtil(Browser* browser, |
217 BrowserActionTestUtil* main_bar) | 219 BrowserActionTestUtil* main_bar) |
218 : browser_(browser), | 220 : browser_(browser), |
219 test_helper_(new TestToolbarActionsBarHelperCocoa( | 221 test_helper_(new TestToolbarActionsBarHelperCocoa( |
220 browser_, GetController(browser_, main_bar->test_helper_.get()))) { | 222 browser_, GetController(browser_, main_bar->test_helper_.get()))) { |
221 } | 223 } |
OLD | NEW |