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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "app/table_model_observer.h" | 7 #include "app/table_model_observer.h" |
8 #import "base/cocoa_protocols_mac.h" | 8 #import "base/cocoa_protocols_mac.h" |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "chrome/browser/cocoa/table_row_nsimage_cache.h" | 10 #include "chrome/browser/cocoa/table_row_nsimage_cache.h" |
11 #include "chrome/browser/search_engines/edit_search_engine_controller.h" | 11 #include "chrome/browser/search_engines/edit_search_engine_controller.h" |
12 #include "chrome/browser/search_engines/keyword_editor_controller.h" | 12 #include "chrome/browser/search_engines/keyword_editor_controller.h" |
13 #include "chrome/browser/search_engines/template_url_model.h" | 13 #include "chrome/browser/search_engines/template_url_model.h" |
14 | 14 |
15 class EditSearchEngineControllerDelegate; | 15 class EditSearchEngineControllerDelegate; |
16 @class KeywordEditorCocoaController; | 16 @class KeywordEditorCocoaController; |
17 class Profile; | 17 class Profile; |
| 18 @class WindowSizeAutosaver; |
18 | 19 |
19 // Very thin bridge that simply pushes notifications from C++ to ObjC. | 20 // Very thin bridge that simply pushes notifications from C++ to ObjC. |
20 class KeywordEditorModelObserver : public TemplateURLModelObserver, | 21 class KeywordEditorModelObserver : public TemplateURLModelObserver, |
21 public EditSearchEngineControllerDelegate, | 22 public EditSearchEngineControllerDelegate, |
22 public TableModelObserver, | 23 public TableModelObserver, |
23 public TableRowNSImageCache::Table { | 24 public TableRowNSImageCache::Table { |
24 public: | 25 public: |
25 explicit KeywordEditorModelObserver(KeywordEditorCocoaController* controller); | 26 explicit KeywordEditorModelObserver(KeywordEditorCocoaController* controller); |
26 virtual ~KeywordEditorModelObserver(); | 27 virtual ~KeywordEditorModelObserver(); |
27 | 28 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 IBOutlet NSTableView* tableView_; | 71 IBOutlet NSTableView* tableView_; |
71 IBOutlet NSButton* addButton_; | 72 IBOutlet NSButton* addButton_; |
72 IBOutlet NSButton* removeButton_; | 73 IBOutlet NSButton* removeButton_; |
73 IBOutlet NSButton* makeDefaultButton_; | 74 IBOutlet NSButton* makeDefaultButton_; |
74 | 75 |
75 scoped_nsobject<NSTextFieldCell> groupCell_; | 76 scoped_nsobject<NSTextFieldCell> groupCell_; |
76 | 77 |
77 Profile* profile_; // weak | 78 Profile* profile_; // weak |
78 scoped_ptr<KeywordEditorController> controller_; | 79 scoped_ptr<KeywordEditorController> controller_; |
79 scoped_ptr<KeywordEditorModelObserver> observer_; | 80 scoped_ptr<KeywordEditorModelObserver> observer_; |
| 81 |
| 82 scoped_nsobject<WindowSizeAutosaver> sizeSaver_; |
80 } | 83 } |
81 @property (readonly) KeywordEditorController* controller; | 84 @property (readonly) KeywordEditorController* controller; |
82 | 85 |
83 // Show the keyword editor associated with the given profile (or the | 86 // Show the keyword editor associated with the given profile (or the |
84 // original profile if this is an incognito profile). If no keyword | 87 // original profile if this is an incognito profile). If no keyword |
85 // editor exists for this profile, create one and show it. Any | 88 // editor exists for this profile, create one and show it. Any |
86 // resulting editor releases itself when closed. | 89 // resulting editor releases itself when closed. |
87 + (void)showKeywordEditor:(Profile*)profile; | 90 + (void)showKeywordEditor:(Profile*)profile; |
88 | 91 |
89 - (KeywordEditorController*)controller; | 92 - (KeywordEditorController*)controller; |
(...skipping 14 matching lines...) Expand all Loading... |
104 | 107 |
105 // Returns a reference to the shared instance for the given profile, | 108 // Returns a reference to the shared instance for the given profile, |
106 // or nil if there is none. | 109 // or nil if there is none. |
107 + (KeywordEditorCocoaController*)sharedInstanceForProfile:(Profile*)profile; | 110 + (KeywordEditorCocoaController*)sharedInstanceForProfile:(Profile*)profile; |
108 | 111 |
109 // Converts a row index in our table view (which has group header rows) into | 112 // Converts a row index in our table view (which has group header rows) into |
110 // one in the |controller_|'s model, which does not have them. | 113 // one in the |controller_|'s model, which does not have them. |
111 - (int)indexInModelForRow:(NSUInteger)row; | 114 - (int)indexInModelForRow:(NSUInteger)row; |
112 | 115 |
113 @end | 116 @end |
OLD | NEW |