OLD | NEW |
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 #import "chrome/browser/cocoa/bookmark_bar_view.h" | 5 #import "chrome/browser/cocoa/bookmark_bar_view.h" |
6 | 6 |
7 #import "chrome/browser/cocoa/bookmark_bar_controller.h" | 7 #import "chrome/browser/cocoa/bookmark_bar_controller.h" |
8 #import "third_party/GTM/AppKit/GTMTheme.h" | 8 #import "third_party/GTM/AppKit/GTMTheme.h" |
9 #import "third_party/mozilla/include/NSPasteboard+Utils.h" | 9 #import "third_party/mozilla/include/NSPasteboard+Utils.h" |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 NSArray* types = [NSArray arrayWithObjects:NSStringPboardType, | 33 NSArray* types = [NSArray arrayWithObjects:NSStringPboardType, |
34 NSHTMLPboardType, NSURLPboardType, nil]; | 34 NSHTMLPboardType, NSURLPboardType, nil]; |
35 [self registerForDraggedTypes:types]; | 35 [self registerForDraggedTypes:types]; |
36 } | 36 } |
37 | 37 |
38 - (void)viewDidMoveToWindow { | 38 - (void)viewDidMoveToWindow { |
39 if ([self window]) | 39 if ([self window]) |
40 [self updateTheme:[self gtm_theme]]; | 40 [self updateTheme:[self gtm_theme]]; |
41 } | 41 } |
42 | 42 |
| 43 // Called after the current theme has changed. |
43 - (void)themeDidChangeNotification:(NSNotification*)aNotification { | 44 - (void)themeDidChangeNotification:(NSNotification*)aNotification { |
44 GTMTheme* theme = [aNotification object]; | 45 GTMTheme* theme = [aNotification object]; |
45 [self updateTheme:theme]; | 46 [self updateTheme:theme]; |
46 } | 47 } |
47 | 48 |
| 49 // Adapt appearance to the current theme. Called after theme changes and before |
| 50 // this is shown for the first time. |
48 - (void)updateTheme:(GTMTheme*)theme { | 51 - (void)updateTheme:(GTMTheme*)theme { |
49 NSColor* color = [theme textColorForStyle:GTMThemeStyleBookmarksBarButton | 52 NSColor* color = [theme textColorForStyle:GTMThemeStyleBookmarksBarButton |
50 state:GTMThemeStateActiveWindow]; | 53 state:GTMThemeStateActiveWindow]; |
51 [noItemTextfield_ setTextColor:color]; | 54 [noItemTextfield_ setTextColor:color]; |
52 } | 55 } |
53 | 56 |
54 // Mouse down events on the bookmark bar should not allow dragging the parent | 57 // Mouse down events on the bookmark bar should not allow dragging the parent |
55 // window around. | 58 // window around. |
56 - (BOOL)mouseDownCanMoveWindow { | 59 - (BOOL)mouseDownCanMoveWindow { |
57 return NO; | 60 return NO; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 NSArray* urls = nil; | 96 NSArray* urls = nil; |
94 NSArray* titles = nil; | 97 NSArray* titles = nil; |
95 [pboard getURLs:&urls andTitles:&titles]; | 98 [pboard getURLs:&urls andTitles:&titles]; |
96 | 99 |
97 return [controller_ addURLs:urls | 100 return [controller_ addURLs:urls |
98 withTitles:titles | 101 withTitles:titles |
99 at:[info draggingLocation]]; | 102 at:[info draggingLocation]]; |
100 } | 103 } |
101 | 104 |
102 @end // @implementation BookmarkBarView | 105 @end // @implementation BookmarkBarView |
OLD | NEW |