OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/ui/cocoa/simple_content_exceptions_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/simple_content_exceptions_window_controller.h" |
6 | 6 |
7 #include "app/l10n_util_mac.h" | 7 #include "app/l10n_util_mac.h" |
8 #include "app/table_model_observer.h" | 8 #include "app/table_model_observer.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #import "base/mac_util.h" | 10 #import "base/mac/mac_util.h" |
11 #import "base/scoped_nsobject.h" | 11 #import "base/scoped_nsobject.h" |
12 #include "base/sys_string_conversions.h" | 12 #include "base/sys_string_conversions.h" |
13 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
14 #include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" | 14 #include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" |
15 | 15 |
16 @interface SimpleContentExceptionsWindowController (Private) | 16 @interface SimpleContentExceptionsWindowController (Private) |
17 - (id)initWithTableModel:(RemoveRowsTableModel*)model; | 17 - (id)initWithTableModel:(RemoveRowsTableModel*)model; |
18 @end | 18 @end |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 const CGFloat kButtonBarHeight = 35.0; | 22 const CGFloat kButtonBarHeight = 35.0; |
23 | 23 |
24 SimpleContentExceptionsWindowController* g_exceptionWindow = nil; | 24 SimpleContentExceptionsWindowController* g_exceptionWindow = nil; |
25 | 25 |
26 } // namespace | 26 } // namespace |
27 | 27 |
28 @implementation SimpleContentExceptionsWindowController | 28 @implementation SimpleContentExceptionsWindowController |
29 | 29 |
30 + (id)controllerWithTableModel:(RemoveRowsTableModel*)model { | 30 + (id)controllerWithTableModel:(RemoveRowsTableModel*)model { |
31 if (!g_exceptionWindow) { | 31 if (!g_exceptionWindow) { |
32 g_exceptionWindow = [[SimpleContentExceptionsWindowController alloc] | 32 g_exceptionWindow = [[SimpleContentExceptionsWindowController alloc] |
33 initWithTableModel:model]; | 33 initWithTableModel:model]; |
34 } | 34 } |
35 return g_exceptionWindow; | 35 return g_exceptionWindow; |
36 } | 36 } |
37 | 37 |
38 - (id)initWithTableModel:(RemoveRowsTableModel*)model { | 38 - (id)initWithTableModel:(RemoveRowsTableModel*)model { |
39 NSString* nibpath = [mac_util::MainAppBundle() | 39 NSString* nibpath = [base::mac::MainAppBundle() |
40 pathForResource:@"SimpleContentExceptionsWindow" | 40 pathForResource:@"SimpleContentExceptionsWindow" |
41 ofType:@"nib"]; | 41 ofType:@"nib"]; |
42 if ((self = [super initWithWindowNibPath:nibpath owner:self])) { | 42 if ((self = [super initWithWindowNibPath:nibpath owner:self])) { |
43 model_.reset(model); | 43 model_.reset(model); |
44 | 44 |
45 // TODO(thakis): autoremember window rect. | 45 // TODO(thakis): autoremember window rect. |
46 // TODO(thakis): sorting support. | 46 // TODO(thakis): sorting support. |
47 } | 47 } |
48 return self; | 48 return self; |
49 } | 49 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 [sheet close]; | 116 [sheet close]; |
117 [sheet orderOut:self]; | 117 [sheet orderOut:self]; |
118 } | 118 } |
119 | 119 |
120 - (IBAction)closeSheet:(id)sender { | 120 - (IBAction)closeSheet:(id)sender { |
121 [NSApp endSheet:[self window]]; | 121 [NSApp endSheet:[self window]]; |
122 } | 122 } |
123 | 123 |
124 | 124 |
125 @end | 125 @end |
OLD | NEW |