OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/importer/importer_host.h" | 5 #include "chrome/browser/importer/importer_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/bookmarks/bookmark_model.h" | 9 #include "chrome/browser/bookmarks/bookmark_model.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
11 #include "chrome/browser/importer/firefox_profile_lock.h" | 11 #include "chrome/browser/importer/firefox_profile_lock.h" |
12 #include "chrome/browser/importer/importer.h" | 12 #include "chrome/browser/importer/importer.h" |
13 #include "chrome/browser/importer/importer_lock_dialog.h" | 13 #include "chrome/browser/importer/importer_lock_dialog.h" |
14 #include "chrome/browser/importer/importer_progress_observer.h" | 14 #include "chrome/browser/importer/importer_progress_observer.h" |
15 #include "chrome/browser/importer/importer_type.h" | 15 #include "chrome/browser/importer/importer_type.h" |
16 #include "chrome/browser/importer/in_process_importer_bridge.h" | 16 #include "chrome/browser/importer/in_process_importer_bridge.h" |
17 #include "chrome/browser/importer/toolbar_importer_utils.h" | 17 #include "chrome/browser/importer/toolbar_importer_utils.h" |
18 #include "chrome/browser/prefs/pref_service.h" | 18 #include "chrome/browser/prefs/pref_service.h" |
19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/browser/search_engines/template_url.h" | 20 #include "chrome/browser/search_engines/template_url.h" |
21 #include "chrome/browser/search_engines/template_url_service.h" | 21 #include "chrome/browser/search_engines/template_url_service.h" |
22 #include "chrome/browser/search_engines/template_url_service_factory.h" | 22 #include "chrome/browser/search_engines/template_url_service_factory.h" |
23 #include "chrome/browser/ui/browser_list.h" | 23 #include "chrome/browser/ui/browser_finder.h" |
24 #include "chrome/common/chrome_notification_types.h" | 24 #include "chrome/common/chrome_notification_types.h" |
25 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
26 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
27 #include "content/public/browser/notification_source.h" | 27 #include "content/public/browser/notification_source.h" |
28 #include "grit/generated_resources.h" | 28 #include "grit/generated_resources.h" |
29 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
30 | 30 |
31 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
32 // TODO(port): Port this file. | 32 // TODO(port): Port this file. |
33 #include "ui/base/win/message_box_win.h" | 33 #include "ui/base/win/message_box_win.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 if (!result) { | 163 if (!result) { |
164 ui::MessageBox( | 164 ui::MessageBox( |
165 NULL, | 165 NULL, |
166 UTF16ToWide(l10n_util::GetStringUTF16( | 166 UTF16ToWide(l10n_util::GetStringUTF16( |
167 IDS_IMPORTER_GOOGLE_LOGIN_TEXT)).c_str(), | 167 IDS_IMPORTER_GOOGLE_LOGIN_TEXT)).c_str(), |
168 L"", | 168 L"", |
169 MB_OK | MB_TOPMOST); | 169 MB_OK | MB_TOPMOST); |
170 | 170 |
171 GURL url("https://accounts.google.com/ServiceLogin"); | 171 GURL url("https://accounts.google.com/ServiceLogin"); |
172 DCHECK(profile_); | 172 DCHECK(profile_); |
173 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); | 173 Browser* browser = browser::FindLastActiveWithProfile(profile_); |
174 if (browser) | 174 if (browser) |
175 browser->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_TYPED); | 175 browser->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_TYPED); |
176 | 176 |
177 MessageLoop::current()->PostTask(FROM_HERE, base::Bind( | 177 MessageLoop::current()->PostTask(FROM_HERE, base::Bind( |
178 &ImporterHost::OnImportLockDialogEnd, this, false)); | 178 &ImporterHost::OnImportLockDialogEnd, this, false)); |
179 } else { | 179 } else { |
180 is_source_readable_ = true; | 180 is_source_readable_ = true; |
181 InvokeTaskIfDone(); | 181 InvokeTaskIfDone(); |
182 } | 182 } |
183 #endif | 183 #endif |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 void ImporterHost::BookmarkModelChanged() { | 264 void ImporterHost::BookmarkModelChanged() { |
265 } | 265 } |
266 | 266 |
267 void ImporterHost::Observe(int type, | 267 void ImporterHost::Observe(int type, |
268 const content::NotificationSource& source, | 268 const content::NotificationSource& source, |
269 const content::NotificationDetails& details) { | 269 const content::NotificationDetails& details) { |
270 DCHECK(type == chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED); | 270 DCHECK(type == chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED); |
271 registrar_.RemoveAll(); | 271 registrar_.RemoveAll(); |
272 InvokeTaskIfDone(); | 272 InvokeTaskIfDone(); |
273 } | 273 } |
OLD | NEW |