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

Side by Side Diff: chrome/browser/cocoa/keyword_editor_cocoa_controller.h

Issue 193040: [Mac] Implement the search engine manager (Closed)
Patch Set: Final patch Created 11 years, 3 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #import <Cocoa/Cocoa.h>
6
7 #include "base/scoped_ptr.h"
8 #include "chrome/browser/search_engines/edit_search_engine_controller.h"
9 #include "chrome/browser/search_engines/keyword_editor_controller.h"
10 #include "chrome/browser/search_engines/template_url_model.h"
11
12 class EditSearchEngineControllerDelegate;
13 @class KeywordEditorCocoaController;
14 class Profile;
15
16 // Very thin bridge that simply pushes notifications from C++ to ObjC.
17 class KeywordEditorModelObserver : public TemplateURLModelObserver,
18 public EditSearchEngineControllerDelegate {
19 public:
20 explicit KeywordEditorModelObserver(KeywordEditorCocoaController* controller);
21 virtual ~KeywordEditorModelObserver();
22
23 // Notification that the template url model has changed in some way.
24 virtual void OnTemplateURLModelChanged();
25
26 // Invoked from the EditSearchEngineController when the user accepts the
27 // edits. NOTE: |template_url| is the value supplied to
28 // EditSearchEngineController's constructor, and may be NULL. A NULL value
29 // indicates a new TemplateURL should be created rather than modifying an
30 // existing TemplateURL.
31 virtual void OnEditedKeyword(const TemplateURL* template_url,
32 const std::wstring& title,
33 const std::wstring& keyword,
34 const std::wstring& url);
35
36 private:
37 KeywordEditorCocoaController* controller_;
38
39 DISALLOW_COPY_AND_ASSIGN(KeywordEditorModelObserver);
40 };
41
42 // This controller manages a window with a table view of search engines. It
43 // acts as |tableView_|'s data source and delegate, feeding it data from the
44 // KeywordEditorController's |table_model()|.
45
46 @interface KeywordEditorCocoaController : NSWindowController {
47 IBOutlet NSTableView* tableView_;
48 IBOutlet NSButton* addButton_;
49 IBOutlet NSButton* removeButton_;
50 IBOutlet NSButton* makeDefaultButton_;
51
52 Profile* profile_; // weak
53 scoped_ptr<KeywordEditorController> controller_;
54 scoped_ptr<KeywordEditorModelObserver> observer_;
55 }
56 @property (readonly) KeywordEditorController* controller;
57
58 - (id)initWithProfile:(Profile*)profile;
59
60 // Message forwarded by KeywordEditorModelObserver.
61 - (void)modelChanged;
62
63 - (IBAction)addKeyword:(id)sender;
64 - (IBAction)deleteKeyword:(id)sender;
65 - (IBAction)makeDefault:(id)sender;
66
67 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698