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

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: Use iterator instead of indexing vector<> 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 (std::vector<GURL>::const_iterator iter(urls.begin());
54 iter != urls.end(); ++iter) {
55 [urlArray addObject:
56 [NSString stringWithUTF8String:iter->spec().c_str()]];
57 }
58
59 [controller_ setServiceURLs:urlArray];
49 } 60 }
50 61
51 void WebIntentPickerCocoa::SetServiceIcon(size_t index, const SkBitmap& icon) { 62 void WebIntentPickerCocoa::SetServiceIcon(size_t index, const SkBitmap& icon) {
52 DCHECK(controller_); 63 DCHECK(controller_);
53 if (icon.empty()) 64 if (icon.empty())
54 return; 65 return;
55 66
56 NSImage* image = gfx::SkBitmapToNSImage(icon); 67 NSImage* image = gfx::SkBitmapToNSImage(icon);
57 [controller_ replaceImageAtIndex:index withImage:image]; 68 [controller_ replaceImageAtIndex:index withImage:image];
58 } 69 }
(...skipping 15 matching lines...) Expand all
74 85
75 void WebIntentPickerCocoa::OnServiceChosen(size_t index) { 86 void WebIntentPickerCocoa::OnServiceChosen(size_t index) {
76 DCHECK(delegate_); 87 DCHECK(delegate_);
77 delegate_->OnServiceChosen(index); 88 delegate_->OnServiceChosen(index);
78 } 89 }
79 90
80 void WebIntentPickerCocoa::set_controller( 91 void WebIntentPickerCocoa::set_controller(
81 WebIntentBubbleController* controller) { 92 WebIntentBubbleController* controller) {
82 controller_ = controller; 93 controller_ = controller;
83 } 94 }
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