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

Side by Side Diff: chrome/browser/ui/cocoa/web_intent_picker_cocoa.mm

Issue 8351008: [Mac] Added tooltip support for web intent picker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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
« no previous file with comments | « chrome/browser/ui/cocoa/web_intent_bubble_controller.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/cocoa/web_intent_picker_cocoa.h" 5 #include "chrome/browser/ui/cocoa/web_intent_picker_cocoa.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
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 28 matching lines...) Expand all
39 anchor = [browser->window()->GetNativeHandle() convertBaseToScreen:anchor]; 39 anchor = [browser->window()->GetNativeHandle() convertBaseToScreen:anchor];
40 40
41 // The controller is deallocated when the window is closed, so no need to 41 // The controller is deallocated when the window is closed, so no need to
42 // worry about it here. 42 // worry about it here.
43 [[WebIntentBubbleController alloc] initWithPicker:this 43 [[WebIntentBubbleController alloc] initWithPicker:this
44 parentWindow:parentWindow 44 parentWindow:parentWindow
45 anchoredAt:anchor]; 45 anchoredAt:anchor];
46 } 46 }
47 47
48 void WebIntentPickerCocoa::SetServiceURLs(const std::vector<GURL>& urls) { 48 void WebIntentPickerCocoa::SetServiceURLs(const std::vector<GURL>& urls) {
49 DCHECK(controller_);
50 scoped_nsobject<NSMutableArray> urlArray(
51 [[NSMutableArray alloc] initWithCapacity:urls.size()]);
52
53 for (size_t i = 0; i < urls.size(); ++i) {
Robert Sesek 2011/10/24 18:00:03 Use an iterator?
groby-ooo-7-16 2011/10/24 21:03:30 Done.
54 [urlArray addObject:
55 [NSString stringWithUTF8String:urls[i].spec().c_str()]];
56 }
57
58 [controller_ setServiceURLs:urlArray];
49 } 59 }
50 60
51 void WebIntentPickerCocoa::SetServiceIcon(size_t index, const SkBitmap& icon) { 61 void WebIntentPickerCocoa::SetServiceIcon(size_t index, const SkBitmap& icon) {
52 DCHECK(controller_); 62 DCHECK(controller_);
53 if (icon.empty()) 63 if (icon.empty())
54 return; 64 return;
55 65
56 NSImage* image = gfx::SkBitmapToNSImage(icon); 66 NSImage* image = gfx::SkBitmapToNSImage(icon);
57 [controller_ replaceImageAtIndex:index withImage:image]; 67 [controller_ replaceImageAtIndex:index withImage:image];
58 } 68 }
(...skipping 15 matching lines...) Expand all
74 84
75 void WebIntentPickerCocoa::OnServiceChosen(size_t index) { 85 void WebIntentPickerCocoa::OnServiceChosen(size_t index) {
76 DCHECK(delegate_); 86 DCHECK(delegate_);
77 delegate_->OnServiceChosen(index); 87 delegate_->OnServiceChosen(index);
78 } 88 }
79 89
80 void WebIntentPickerCocoa::set_controller( 90 void WebIntentPickerCocoa::set_controller(
81 WebIntentBubbleController* controller) { 91 WebIntentBubbleController* controller) {
82 controller_ = controller; 92 controller_ = controller;
83 } 93 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/web_intent_bubble_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698