OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
11 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/browser_window.h" | 13 #include "chrome/browser/ui/browser_window.h" |
13 #include "chrome/browser/ui/extensions/extension_action_view_controller.h" | 14 #include "chrome/browser/ui/extensions/extension_action_view_controller.h" |
14 #include "chrome/browser/ui/views/extensions/extension_popup.h" | 15 #include "chrome/browser/ui/views/extensions/extension_popup.h" |
15 #include "chrome/browser/ui/views/frame/browser_view.h" | 16 #include "chrome/browser/ui/views/frame/browser_view.h" |
16 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" | 17 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" |
17 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" | 18 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" |
18 #include "chrome/browser/ui/views/toolbar/toolbar_action_view.h" | 19 #include "chrome/browser/ui/views/toolbar/toolbar_action_view.h" |
19 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 20 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 void BrowserActionTestUtil::SetWidth(int width) { | 202 void BrowserActionTestUtil::SetWidth(int width) { |
202 BrowserActionsContainer* container = | 203 BrowserActionsContainer* container = |
203 GetContainer(browser_, test_helper_.get()); | 204 GetContainer(browser_, test_helper_.get()); |
204 container->SetSize(gfx::Size(width, container->height())); | 205 container->SetSize(gfx::Size(width, container->height())); |
205 } | 206 } |
206 | 207 |
207 ToolbarActionsBar* BrowserActionTestUtil::GetToolbarActionsBar() { | 208 ToolbarActionsBar* BrowserActionTestUtil::GetToolbarActionsBar() { |
208 return GetContainer(browser_, test_helper_.get())->toolbar_actions_bar(); | 209 return GetContainer(browser_, test_helper_.get())->toolbar_actions_bar(); |
209 } | 210 } |
210 | 211 |
211 scoped_ptr<BrowserActionTestUtil> BrowserActionTestUtil::CreateOverflowBar() { | 212 std::unique_ptr<BrowserActionTestUtil> |
| 213 BrowserActionTestUtil::CreateOverflowBar() { |
212 CHECK(!GetToolbarActionsBar()->in_overflow_mode()) | 214 CHECK(!GetToolbarActionsBar()->in_overflow_mode()) |
213 << "Only a main bar can create an overflow bar!"; | 215 << "Only a main bar can create an overflow bar!"; |
214 return make_scoped_ptr(new BrowserActionTestUtil(browser_, this)); | 216 return base::WrapUnique(new BrowserActionTestUtil(browser_, this)); |
215 } | 217 } |
216 | 218 |
217 // static | 219 // static |
218 gfx::Size BrowserActionTestUtil::GetMinPopupSize() { | 220 gfx::Size BrowserActionTestUtil::GetMinPopupSize() { |
219 return gfx::Size(ExtensionPopup::kMinWidth, ExtensionPopup::kMinHeight); | 221 return gfx::Size(ExtensionPopup::kMinWidth, ExtensionPopup::kMinHeight); |
220 } | 222 } |
221 | 223 |
222 // static | 224 // static |
223 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() { | 225 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() { |
224 return gfx::Size(ExtensionPopup::kMaxWidth, ExtensionPopup::kMaxHeight); | 226 return gfx::Size(ExtensionPopup::kMaxWidth, ExtensionPopup::kMaxHeight); |
225 } | 227 } |
226 | 228 |
227 BrowserActionTestUtil::BrowserActionTestUtil(Browser* browser, | 229 BrowserActionTestUtil::BrowserActionTestUtil(Browser* browser, |
228 BrowserActionTestUtil* main_bar) | 230 BrowserActionTestUtil* main_bar) |
229 : browser_(browser), | 231 : browser_(browser), |
230 test_helper_(new TestToolbarActionsBarHelperViews( | 232 test_helper_(new TestToolbarActionsBarHelperViews( |
231 browser_, | 233 browser_, |
232 GetContainer(browser_, main_bar->test_helper_.get()))) { | 234 GetContainer(browser_, main_bar->test_helper_.get()))) { |
233 } | 235 } |
OLD | NEW |