Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: chrome/browser/ui/views/toolbar/browser_action_test_util_views.cc

Issue 419023002: Move ShowPopup logic from BrowserActionsContainer to BrowserActionView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/extensions/extension_action_manager.h" 8 #include "chrome/browser/extensions/extension_action_manager.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_window.h" 10 #include "chrome/browser/ui/browser_window.h"
(...skipping 23 matching lines...) Expand all
34 return GetContainer(browser_)->VisibleBrowserActions(); 34 return GetContainer(browser_)->VisibleBrowserActions();
35 } 35 }
36 36
37 ExtensionAction* BrowserActionTestUtil::GetExtensionAction(int index) { 37 ExtensionAction* BrowserActionTestUtil::GetExtensionAction(int index) {
38 return extensions::ExtensionActionManager::Get(browser_->profile())-> 38 return extensions::ExtensionActionManager::Get(browser_->profile())->
39 GetBrowserAction(*GetContainer(browser_)->GetBrowserActionViewAt(index)-> 39 GetBrowserAction(*GetContainer(browser_)->GetBrowserActionViewAt(index)->
40 button()->extension()); 40 button()->extension());
41 } 41 }
42 42
43 void BrowserActionTestUtil::InspectPopup(int index) { 43 void BrowserActionTestUtil::InspectPopup(int index) {
44 GetContainer(browser_)->InspectPopup(GetExtensionAction(index)); 44 GetContainer(browser_)->GetBrowserActionViewAt(index)->button()->
45 InspectPopup();
45 } 46 }
46 47
47 bool BrowserActionTestUtil::HasIcon(int index) { 48 bool BrowserActionTestUtil::HasIcon(int index) {
48 return !GetContainer(browser_)->GetBrowserActionViewAt(index)->button()-> 49 return !GetContainer(browser_)->GetBrowserActionViewAt(index)->button()->
49 GetImage(views::Button::STATE_NORMAL).isNull(); 50 GetImage(views::Button::STATE_NORMAL).isNull();
50 } 51 }
51 52
52 gfx::Image BrowserActionTestUtil::GetIcon(int index) { 53 gfx::Image BrowserActionTestUtil::GetIcon(int index) {
53 gfx::ImageSkia icon = GetContainer(browser_)->GetBrowserActionViewAt(index)-> 54 gfx::ImageSkia icon = GetContainer(browser_)->GetBrowserActionViewAt(index)->
54 button()->GetIconForTest(); 55 button()->GetIconForTest();
55 return gfx::Image(icon); 56 return gfx::Image(icon);
56 } 57 }
57 58
58 void BrowserActionTestUtil::Press(int index) { 59 void BrowserActionTestUtil::Press(int index) {
59 GetContainer(browser_)->TestExecuteBrowserAction(index); 60 GetContainer(browser_)->GetBrowserActionViewAt(index)->
61 button()->ExecuteBrowserAction();
60 } 62 }
61 63
62 std::string BrowserActionTestUtil::GetExtensionId(int index) { 64 std::string BrowserActionTestUtil::GetExtensionId(int index) {
63 BrowserActionButton* button = 65 BrowserActionButton* button =
64 GetContainer(browser_)->GetBrowserActionViewAt(index)->button(); 66 GetContainer(browser_)->GetBrowserActionViewAt(index)->button();
65 return button->extension()->id(); 67 return button->extension()->id();
66 } 68 }
67 69
68 std::string BrowserActionTestUtil::GetTooltip(int index) { 70 std::string BrowserActionTestUtil::GetTooltip(int index) {
69 base::string16 text; 71 base::string16 text;
70 GetContainer(browser_)->GetBrowserActionViewAt(index)->button()-> 72 GetContainer(browser_)->GetBrowserActionViewAt(index)->button()->
71 GetTooltipText(gfx::Point(), &text); 73 GetTooltipText(gfx::Point(), &text);
72 return base::UTF16ToUTF8(text); 74 return base::UTF16ToUTF8(text);
73 } 75 }
74 76
75 gfx::NativeView BrowserActionTestUtil::GetPopupNativeView() { 77 gfx::NativeView BrowserActionTestUtil::GetPopupNativeView() {
76 return GetContainer(browser_)->TestGetPopup()->GetWidget()->GetNativeView(); 78 return GetContainer(browser_)->TestGetPopup()->GetWidget()->GetNativeView();
77 } 79 }
78 80
79 bool BrowserActionTestUtil::HasPopup() { 81 bool BrowserActionTestUtil::HasPopup() {
80 return GetContainer(browser_)->TestGetPopup() != NULL; 82 return GetContainer(browser_)->TestGetPopup() != NULL;
81 } 83 }
82 84
83 gfx::Rect BrowserActionTestUtil::GetPopupBounds() { 85 gfx::Rect BrowserActionTestUtil::GetPopupBounds() {
84 return GetContainer(browser_)->TestGetPopup()->bounds(); 86 return GetContainer(browser_)->TestGetPopup()->bounds();
85 } 87 }
86 88
87 bool BrowserActionTestUtil::HidePopup() { 89 bool BrowserActionTestUtil::HidePopup() {
88 GetContainer(browser_)->HidePopup(); 90 GetContainer(browser_)->HideActivePopup();
89 return !HasPopup(); 91 return !HasPopup();
90 } 92 }
91 93
92 void BrowserActionTestUtil::SetIconVisibilityCount(size_t icons) { 94 void BrowserActionTestUtil::SetIconVisibilityCount(size_t icons) {
93 GetContainer(browser_)->TestSetIconVisibilityCount(icons); 95 GetContainer(browser_)->TestSetIconVisibilityCount(icons);
94 } 96 }
95 97
96 gfx::Size BrowserActionTestUtil::GetMinPopupSize() { 98 gfx::Size BrowserActionTestUtil::GetMinPopupSize() {
97 return gfx::Size(ExtensionPopup::kMinWidth, ExtensionPopup::kMinHeight); 99 return gfx::Size(ExtensionPopup::kMinWidth, ExtensionPopup::kMinHeight);
98 } 100 }
99 101
100 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() { 102 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() {
101 return gfx::Size(ExtensionPopup::kMaxWidth, ExtensionPopup::kMaxHeight); 103 return gfx::Size(ExtensionPopup::kMaxWidth, ExtensionPopup::kMaxHeight);
102 } 104 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/page_action_image_view.cc ('k') | chrome/browser/ui/views/toolbar/browser_action_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698