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

Side by Side Diff: chrome/browser/ui/panels/panel_window_controller_cocoa.mm

Issue 7734003: Implement basic theming for panel titlebars. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 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) 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/panels/panel_window_controller_cocoa.h" 5 #include "chrome/browser/ui/panels/panel_window_controller_cocoa.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
11 #include "chrome/app/chrome_command_ids.h" // IDC_* 11 #include "chrome/app/chrome_command_ids.h" // IDC_*
12 #include "chrome/browser/tabs/tab_strip_model.h" 12 #include "chrome/browser/tabs/tab_strip_model.h"
13 #include "chrome/browser/themes/theme_service.h"
14 #include "chrome/browser/themes/theme_service_factory.h"
13 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
14 #import "chrome/browser/ui/cocoa/event_utils.h" 16 #import "chrome/browser/ui/cocoa/event_utils.h"
15 #import "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" 17 #import "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h"
16 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h" 18 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h"
17 #include "chrome/browser/ui/panels/panel.h" 19 #include "chrome/browser/ui/panels/panel.h"
18 #include "chrome/browser/ui/panels/panel_browser_window_cocoa.h" 20 #include "chrome/browser/ui/panels/panel_browser_window_cocoa.h"
19 #import "chrome/browser/ui/panels/panel_titlebar_view_cocoa.h" 21 #import "chrome/browser/ui/panels/panel_titlebar_view_cocoa.h"
20 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" 22 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h"
21 #include "content/browser/tab_contents/tab_contents.h" 23 #include "content/browser/tab_contents/tab_contents.h"
22 24
23 const int kMinimumWindowSize = 1; 25 const int kMinimumWindowSize = 1;
24 26
25 @implementation PanelWindowControllerCocoa 27 @implementation PanelWindowControllerCocoa
26 28
27 - (id)initWithBrowserWindow:(PanelBrowserWindowCocoa*)window { 29 - (id)initWithBrowserWindow:(PanelBrowserWindowCocoa*)window {
28 NSString* nibpath = 30 NSString* nibpath =
29 [base::mac::MainAppBundle() pathForResource:@"Panel" ofType:@"nib"]; 31 [base::mac::MainAppBundle() pathForResource:@"Panel" ofType:@"nib"];
30 if ((self = [super initWithWindowNibPath:nibpath owner:self])) 32 if ((self = [super initWithWindowNibPath:nibpath owner:self]))
31 windowShim_.reset(window); 33 windowShim_.reset(window);
32 return self; 34 return self;
33 } 35 }
34 36
37 - (ui::ThemeProvider*)themeProvider {
38 return ThemeServiceFactory::GetForProfile(windowShim_->browser()->profile());
39 }
40
35 - (void)awakeFromNib { 41 - (void)awakeFromNib {
36 NSWindow* window = [self window]; 42 NSWindow* window = [self window];
37 43
38 DCHECK(window); 44 DCHECK(window);
39 DCHECK(titlebar_view_); 45 DCHECK(titlebar_view_);
40 DCHECK_EQ(self, [window delegate]); 46 DCHECK_EQ(self, [window delegate]);
41 47
42 // Using NSModalPanelWindowLevel (8) rather then NSStatusWindowLevel (25) 48 // Using NSModalPanelWindowLevel (8) rather then NSStatusWindowLevel (25)
43 // ensures notification balloons on top of regular windows, but below 49 // ensures notification balloons on top of regular windows, but below
44 // popup menus which are at NSPopUpMenuWindowLevel (101) and Spotlight 50 // popup menus which are at NSPopUpMenuWindowLevel (101) and Spotlight
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 // When windowShouldClose returns YES (or if controller receives direct 'close' 212 // When windowShouldClose returns YES (or if controller receives direct 'close'
207 // signal), window will be unconditionally closed. Clean up. 213 // signal), window will be unconditionally closed. Clean up.
208 - (void)windowWillClose:(NSNotification*)notification { 214 - (void)windowWillClose:(NSNotification*)notification {
209 DCHECK(windowShim_->browser()->tabstrip_model()->empty()); 215 DCHECK(windowShim_->browser()->tabstrip_model()->empty());
210 216
211 windowShim_->didCloseNativeWindow(); 217 windowShim_->didCloseNativeWindow();
212 [self autorelease]; 218 [self autorelease];
213 } 219 }
214 220
215 @end 221 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698