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_finder.h" | 23 #include "chrome/browser/ui/browser_finder.h" |
| 24 #include "chrome/browser/ui/browser_tabstrip.h" |
24 #include "chrome/browser/ui/simple_message_box.h" | 25 #include "chrome/browser/ui/simple_message_box.h" |
25 #include "chrome/common/chrome_notification_types.h" | 26 #include "chrome/common/chrome_notification_types.h" |
26 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
27 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
28 #include "content/public/browser/notification_source.h" | 29 #include "content/public/browser/notification_source.h" |
29 #include "grit/generated_resources.h" | 30 #include "grit/generated_resources.h" |
30 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
31 | 32 |
32 using content::BrowserThread; | 33 using content::BrowserThread; |
33 | 34 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 #if defined(OS_WIN) | 159 #if defined(OS_WIN) |
159 if (!result) { | 160 if (!result) { |
160 browser::ShowMessageBox(NULL, | 161 browser::ShowMessageBox(NULL, |
161 l10n_util::GetStringUTF16(IDS_IMPORTER_GOOGLE_LOGIN_TEXT), string16(), | 162 l10n_util::GetStringUTF16(IDS_IMPORTER_GOOGLE_LOGIN_TEXT), string16(), |
162 browser::MESSAGE_BOX_TYPE_INFORMATION); | 163 browser::MESSAGE_BOX_TYPE_INFORMATION); |
163 | 164 |
164 GURL url("https://accounts.google.com/ServiceLogin"); | 165 GURL url("https://accounts.google.com/ServiceLogin"); |
165 DCHECK(profile_); | 166 DCHECK(profile_); |
166 Browser* browser = browser::FindLastActiveWithProfile(profile_); | 167 Browser* browser = browser::FindLastActiveWithProfile(profile_); |
167 if (browser) | 168 if (browser) |
168 browser->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_TYPED); | 169 chrome::AddSelectedTabWithURL(browser, url, |
| 170 content::PAGE_TRANSITION_TYPED); |
169 | 171 |
170 MessageLoop::current()->PostTask(FROM_HERE, base::Bind( | 172 MessageLoop::current()->PostTask(FROM_HERE, base::Bind( |
171 &ImporterHost::OnImportLockDialogEnd, this, false)); | 173 &ImporterHost::OnImportLockDialogEnd, this, false)); |
172 } else { | 174 } else { |
173 is_source_readable_ = true; | 175 is_source_readable_ = true; |
174 InvokeTaskIfDone(); | 176 InvokeTaskIfDone(); |
175 } | 177 } |
176 #endif | 178 #endif |
177 } | 179 } |
178 | 180 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 void ImporterHost::BookmarkModelChanged() { | 259 void ImporterHost::BookmarkModelChanged() { |
258 } | 260 } |
259 | 261 |
260 void ImporterHost::Observe(int type, | 262 void ImporterHost::Observe(int type, |
261 const content::NotificationSource& source, | 263 const content::NotificationSource& source, |
262 const content::NotificationDetails& details) { | 264 const content::NotificationDetails& details) { |
263 DCHECK(type == chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED); | 265 DCHECK(type == chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED); |
264 registrar_.RemoveAll(); | 266 registrar_.RemoveAll(); |
265 InvokeTaskIfDone(); | 267 InvokeTaskIfDone(); |
266 } | 268 } |
OLD | NEW |