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

Side by Side Diff: chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.mm

Issue 10662041: mac: Remove nav.pdf in favor of IDR_DEFAULT_FAVICON. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 5 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bookmarks/bookmark_pasteboard_helper_mac.h" 5 #include "chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 10
11 #include "base/memory/scoped_nsobject.h" 11 #include "base/memory/scoped_nsobject.h"
12 #include "base/sys_string_conversions.h" 12 #include "base/sys_string_conversions.h"
13 #include "chrome/browser/bookmarks/bookmark_model.h" 13 #include "chrome/browser/bookmarks/bookmark_model.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" 15 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h"
16 #include "grit/ui_resources_standard.h"
16 #include "skia/ext/skia_utils_mac.h" 17 #include "skia/ext/skia_utils_mac.h"
18 #include "ui/base/resource/resource_bundle.h"
17 #include "ui/gfx/mac/nsimage_cache.h" 19 #include "ui/gfx/mac/nsimage_cache.h"
18 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" 20 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
19 21
20 NSString* const kBookmarkDictionaryListPboardType = 22 NSString* const kBookmarkDictionaryListPboardType =
21 @"BookmarkDictionaryListPboardType"; 23 @"BookmarkDictionaryListPboardType";
22 24
23 namespace { 25 namespace {
24 26
25 // An unofficial standard pasteboard title type to be provided alongside the 27 // An unofficial standard pasteboard title type to be provided alongside the
26 // |NSURLPboardType|. 28 // |NSURLPboardType|.
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 NSArray* availableTypes = 343 NSArray* availableTypes =
342 [NSArray arrayWithObjects:kBookmarkDictionaryListPboardType, 344 [NSArray arrayWithObjects:kBookmarkDictionaryListPboardType,
343 kCrWebURLsWithTitlesPboardType, 345 kCrWebURLsWithTitlesPboardType,
344 NSURLPboardType, 346 NSURLPboardType,
345 nil]; 347 nil];
346 return [pb availableTypeFromArray:availableTypes] != nil; 348 return [pb availableTypeFromArray:availableTypes] != nil;
347 } 349 }
348 350
349 NSImage* DragImageForBookmark(NSImage* favicon, const string16& title) { 351 NSImage* DragImageForBookmark(NSImage* favicon, const string16& title) {
350 // If no favicon, use a default. 352 // If no favicon, use a default.
351 if (!favicon) 353 if (!favicon) {
352 favicon = gfx::GetCachedImageWithName(@"nav.pdf"); 354 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
Avi (use Gerrit) 2012/06/26 14:28:27 How soon will it be before we can get rid of GetCa
Nico 2012/06/26 21:45:44 Two more pages of callers left according to cs
355 favicon = rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON);
356 }
353 357
354 // If no title, just use icon. 358 // If no title, just use icon.
355 if (title.empty()) 359 if (title.empty())
356 return favicon; 360 return favicon;
357 NSString* ns_title = base::SysUTF16ToNSString(title); 361 NSString* ns_title = base::SysUTF16ToNSString(title);
358 362
359 // Set the look of the title. 363 // Set the look of the title.
360 NSDictionary* attrs = 364 NSDictionary* attrs =
361 [NSDictionary dictionaryWithObject:[NSFont systemFontOfSize: 365 [NSDictionary dictionaryWithObject:[NSFont systemFontOfSize:
362 [NSFont smallSystemFontSize]] 366 [NSFont smallSystemFontSize]]
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 [window dragImage:drag_image 429 [window dragImage:drag_image
426 at:position 430 at:position
427 offset:NSZeroSize 431 offset:NSZeroSize
428 event:drag_event 432 event:drag_event
429 pasteboard:[NSPasteboard pasteboardWithName:NSDragPboard] 433 pasteboard:[NSPasteboard pasteboardWithName:NSDragPboard]
430 source:nil 434 source:nil
431 slideBack:YES]; 435 slideBack:YES];
432 } 436 }
433 437
434 } // namespace bookmark_pasteboard_helper_mac 438 } // namespace bookmark_pasteboard_helper_mac
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chrome_content_browser_client.cc » ('j') | chrome/browser/ui/cocoa/tab_contents/favicon_util.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698