OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_IMPORTER_IMPORT_PROGRESS_DIALOG_H_ | |
6 #define CHROME_BROWSER_IMPORTER_IMPORT_PROGRESS_DIALOG_H_ | |
7 | |
8 #import <Cocoa/Cocoa.h> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "base/compiler_specific.h" | |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "chrome/browser/importer/importer_data_types.h" | |
14 #include "chrome/browser/importer/importer_progress_observer.h" | |
15 | |
16 class ImporterHost; | |
17 class ImporterObserver; | |
18 class ImporterObserverBridge; | |
19 | |
20 // Class that acts as a controller for the dialog that shows progress for an | |
21 // import operation. | |
22 // Lifetime: This object is responsible for deleting itself. | |
23 @interface ImportProgressDialogController : NSWindowController { | |
24 scoped_ptr<ImporterObserverBridge> import_host_observer_bridge_; | |
25 ImporterHost* importer_host_; // (weak) | |
26 ImporterObserver* observer_; // (weak) | |
27 | |
28 // Strings bound to static labels in the UI dialog. | |
29 NSString* explanatory_text_; | |
30 NSString* favorites_status_text_; | |
31 NSString* search_status_text_; | |
32 NSString* saved_password_status_text_; | |
33 NSString* history_status_text_; | |
34 | |
35 // Bound to the color of the status text (this is the easiest way to disable | |
36 // progress items that aren't supported by the current browser we're importing | |
37 // from). | |
38 NSColor* favorites_import_enabled_; | |
39 NSColor* search_import_enabled_; | |
40 NSColor* password_import_enabled_; | |
41 NSColor* history_import_enabled_; | |
42 | |
43 // Placeholders for "Importing..." and "Done" text. | |
44 NSString* progress_text_; | |
45 NSString* done_text_; | |
46 } | |
47 | |
48 @property(nonatomic, retain) NSString* explanatoryText; | |
49 @property(nonatomic, retain) NSString* favoritesStatusText; | |
50 @property(nonatomic, retain) NSString* searchStatusText; | |
51 @property(nonatomic, retain) NSString* savedPasswordStatusText; | |
52 @property(nonatomic, retain) NSString* historyStatusText; | |
53 | |
54 @property(nonatomic, retain) NSColor* favoritesImportEnabled; | |
55 @property(nonatomic, retain) NSColor* searchImportEnabled; | |
56 @property(nonatomic, retain) NSColor* passwordImportEnabled; | |
57 @property(nonatomic, retain) NSColor* historyImportEnabled; | |
58 | |
59 // Cancel button calls this. | |
60 - (IBAction)cancel:(id)sender; | |
61 | |
62 // Closes the dialog. | |
63 - (void)closeDialog; | |
64 | |
65 // Methods called by importer_host via ImporterObserverBridge. | |
66 - (void)ImportItemStarted:(importer::ImportItem)item; | |
67 - (void)ImportItemEnded:(importer::ImportItem)item; | |
68 - (void)ImportEnded; | |
69 | |
70 @end | |
71 | |
72 // C++ -> objc bridge for import status notifications. | |
73 class ImporterObserverBridge : public importer::ImporterProgressObserver { | |
74 public: | |
75 ImporterObserverBridge(ImportProgressDialogController* owner); | |
76 virtual ~ImporterObserverBridge(); | |
77 | |
78 private: | |
79 // importer::ImporterProgressObserver: | |
80 virtual void ImportStarted() OVERRIDE; | |
81 virtual void ImportItemStarted(importer::ImportItem item) OVERRIDE; | |
82 virtual void ImportItemEnded(importer::ImportItem item) OVERRIDE; | |
83 virtual void ImportEnded() OVERRIDE; | |
84 | |
85 ImportProgressDialogController* owner_; | |
86 | |
87 DISALLOW_COPY_AND_ASSIGN(ImporterObserverBridge); | |
88 }; | |
89 | |
90 #endif // CHROME_BROWSER_IMPORTER_IMPORT_PROGRESS_DIALOG_H_ | |
OLD | NEW |