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 "chrome/browser/cocoa/import_progress_dialog.h" | 5 #import "chrome/browser/cocoa/import_progress_dialog.h" |
6 | 6 |
7 #include "app/l10n_util_mac.h" | 7 #include "app/l10n_util_mac.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #import "base/scoped_nsobject.h" | 10 #import "base/scoped_nsobject.h" |
11 #include "base/string_util.h" | |
11 #import "base/sys_string_conversions.h" | 12 #import "base/sys_string_conversions.h" |
13 #include "grit/chromium_strings.h" | |
12 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
13 | 15 |
14 namespace { | 16 namespace { |
15 | 17 |
16 // Convert ImportItem enum into the name of the ImportProgressDialogController | 18 // Convert ImportItem enum into the name of the ImportProgressDialogController |
17 // property corresponding to the text for that item, this makes the code to | 19 // property corresponding to the text for that item, this makes the code to |
18 // change the values for said properties much more readable. | 20 // change the values for said properties much more readable. |
19 NSString* keyForImportItem(ImportItem item) { | 21 NSString* keyForImportItem(ImportItem item) { |
20 switch(item) { | 22 switch(item) { |
21 case HISTORY: | 23 case HISTORY: |
(...skipping 30 matching lines...) Expand all Loading... | |
52 browserName:(string16)browserName | 54 browserName:(string16)browserName |
53 observer:(ImportObserver*)observer | 55 observer:(ImportObserver*)observer |
54 itemsEnabled:(int16)items; { | 56 itemsEnabled:(int16)items; { |
55 self = [super initWithWindowNibName:@"ImportProgressDialog"]; | 57 self = [super initWithWindowNibName:@"ImportProgressDialog"]; |
56 if (self != nil) { | 58 if (self != nil) { |
57 importer_host_ = host; | 59 importer_host_ = host; |
58 observer_ = observer; | 60 observer_ = observer; |
59 import_host_observer_bridge_.reset(new ImporterObserverBridge(self)); | 61 import_host_observer_bridge_.reset(new ImporterObserverBridge(self)); |
60 importer_host_->SetObserver(import_host_observer_bridge_.get()); | 62 importer_host_->SetObserver(import_host_observer_bridge_.get()); |
61 | 63 |
64 string16 productName = WideToUTF16( | |
65 l10n_util::GetString(IDS_PRODUCT_NAME)); | |
TVL
2009/09/07 21:08:11
l10n_util::GetStringUTF16() will do this into a st
| |
62 NSString* explanatory_text = l10n_util::GetNSStringF( | 66 NSString* explanatory_text = l10n_util::GetNSStringF( |
63 IDS_IMPORT_PROGRESS_EXPLANATORY_TEXT_MAC, browserName); | 67 IDS_IMPORT_PROGRESS_EXPLANATORY_TEXT_MAC, |
68 productName, | |
69 browserName); | |
64 [self setExplanatoryText:explanatory_text]; | 70 [self setExplanatoryText:explanatory_text]; |
65 | 71 |
66 progress_text_ = | 72 progress_text_ = |
67 [l10n_util::GetNSString(IDS_IMPORT_IMPORTING_PROGRESS_TEXT_MAC) retain]; | 73 [l10n_util::GetNSString(IDS_IMPORT_IMPORTING_PROGRESS_TEXT_MAC) retain]; |
68 done_text_ = | 74 done_text_ = |
69 [l10n_util::GetNSString(IDS_IMPORT_IMPORTING_DONE_TEXT_MAC) retain]; | 75 [l10n_util::GetNSString(IDS_IMPORT_IMPORTING_DONE_TEXT_MAC) retain]; |
70 | 76 |
71 // Enable/disable item titles. | 77 // Enable/disable item titles. |
72 NSColor* disabled = [NSColor disabledControlTextColor]; | 78 NSColor* disabled = [NSColor disabledControlTextColor]; |
73 NSColor* active = [NSColor textColor]; | 79 NSColor* active = [NSColor textColor]; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
178 NSWindow* progress_window = [progress_dialog_ window]; | 184 NSWindow* progress_window = [progress_dialog_ window]; |
179 NSModalSession session = [NSApp beginModalSessionForWindow:progress_window]; | 185 NSModalSession session = [NSApp beginModalSessionForWindow:progress_window]; |
180 [progress_dialog_ showWindow:nil]; | 186 [progress_dialog_ showWindow:nil]; |
181 while(1) { | 187 while(1) { |
182 if ([NSApp runModalSession:session] != NSRunContinuesResponse) | 188 if ([NSApp runModalSession:session] != NSRunContinuesResponse) |
183 break; | 189 break; |
184 MessageLoop::current()->RunAllPending(); | 190 MessageLoop::current()->RunAllPending(); |
185 } | 191 } |
186 [NSApp endModalSession:session]; | 192 [NSApp endModalSession:session]; |
187 } | 193 } |
OLD | NEW |