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

Side by Side Diff: chrome/browser/extensions/browser_action_test_util_mac.mm

Issue 10855154: Update browserAction.setIcon and pageAction.setIcon for hidpi (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: .. Created 8 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 | Annotate | Revision Log
OLDNEW
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 "browser_action_test_util.h" 5 #include "browser_action_test_util.h"
6 6
7 #include "base/mac/foundation_util.h"
7 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
8 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
9 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" 10 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h"
10 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 11 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
11 #import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h" 12 #import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h"
12 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" 13 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h"
13 #import "chrome/browser/ui/cocoa/info_bubble_window.h" 14 #import "chrome/browser/ui/cocoa/info_bubble_window.h"
14 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" 15 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
15 #include "ui/gfx/rect.h" 16 #include "ui/gfx/rect.h"
16 #include "ui/gfx/size.h" 17 #include "ui/gfx/size.h"
(...skipping 15 matching lines...) Expand all
32 } // namespace 33 } // namespace
33 34
34 int BrowserActionTestUtil::NumberOfBrowserActions() { 35 int BrowserActionTestUtil::NumberOfBrowserActions() {
35 return [GetController(browser_) buttonCount]; 36 return [GetController(browser_) buttonCount];
36 } 37 }
37 38
38 bool BrowserActionTestUtil::HasIcon(int index) { 39 bool BrowserActionTestUtil::HasIcon(int index) {
39 return [GetButton(browser_, index) image] != nil; 40 return [GetButton(browser_, index) image] != nil;
40 } 41 }
41 42
43 gfx::Image BrowserActionTestUtil::GetIcon(int index) {
44 NSImage* ns_image = [GetButton(browser_, index) image];
45 // gfx::Image takes ownership of the |ns_image| reference. We have to increase
46 // the ref count so |ns_image| stays around when the image object is
47 // destroyed.
48 base::mac::NSObjectRetain(ns_image);
49 return gfx::Image(ns_image);
50 }
51
42 void BrowserActionTestUtil::Press(int index) { 52 void BrowserActionTestUtil::Press(int index) {
43 NSButton* button = GetButton(browser_, index); 53 NSButton* button = GetButton(browser_, index);
44 [button performClick:nil]; 54 [button performClick:nil];
45 } 55 }
46 56
47 std::string BrowserActionTestUtil::GetTooltip(int index) { 57 std::string BrowserActionTestUtil::GetTooltip(int index) {
48 NSString* tooltip = [GetButton(browser_, index) toolTip]; 58 NSString* tooltip = [GetButton(browser_, index) toolTip];
49 return base::SysNSStringToUTF8(tooltip); 59 return base::SysNSStringToUTF8(tooltip);
50 } 60 }
51 61
(...skipping 14 matching lines...) Expand all
66 return !HasPopup(); 76 return !HasPopup();
67 } 77 }
68 78
69 gfx::Size BrowserActionTestUtil::GetMinPopupSize() { 79 gfx::Size BrowserActionTestUtil::GetMinPopupSize() {
70 return gfx::Size(NSSizeToCGSize([ExtensionPopupController minPopupSize])); 80 return gfx::Size(NSSizeToCGSize([ExtensionPopupController minPopupSize]));
71 } 81 }
72 82
73 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() { 83 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() {
74 return gfx::Size(NSSizeToCGSize([ExtensionPopupController maxPopupSize])); 84 return gfx::Size(NSSizeToCGSize([ExtensionPopupController maxPopupSize]));
75 } 85 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698