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/printing/print_dialog_cloud.h" | 5 #include "chrome/browser/printing/print_dialog_cloud.h" |
6 #include "chrome/browser/printing/print_dialog_cloud_internal.h" | 6 #include "chrome/browser/printing/print_dialog_cloud_internal.h" |
7 | 7 |
8 #include "base/base64.h" | 8 #include "base/base64.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/json/json_reader.h" | 13 #include "base/json/json_reader.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "chrome/browser/browser_process_impl.h" | 16 #include "chrome/browser/browser_process_impl.h" |
17 #include "chrome/browser/debugger/devtools_window.h" | 17 #include "chrome/browser/debugger/devtools_window.h" |
18 #include "chrome/browser/prefs/pref_service.h" | 18 #include "chrome/browser/prefs/pref_service.h" |
19 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" | 19 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" |
20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
21 #include "chrome/browser/profiles/profile_manager.h" | 21 #include "chrome/browser/profiles/profile_manager.h" |
22 #include "chrome/browser/ui/browser_dialogs.h" | 22 #include "chrome/browser/ui/browser_dialogs.h" |
| 23 #include "chrome/browser/ui/browser.h" |
| 24 #include "chrome/browser/ui/browser_finder.h" |
23 #include "chrome/browser/ui/browser_list.h" | 25 #include "chrome/browser/ui/browser_list.h" |
24 #include "chrome/browser/ui/browser_window.h" | 26 #include "chrome/browser/ui/browser_window.h" |
25 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 27 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
26 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
27 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
28 #include "chrome/common/print_messages.h" | 30 #include "chrome/common/print_messages.h" |
29 #include "chrome/common/url_constants.h" | 31 #include "chrome/common/url_constants.h" |
30 #include "content/public/browser/browser_thread.h" | 32 #include "content/public/browser/browser_thread.h" |
31 #include "content/public/browser/navigation_controller.h" | 33 #include "content/public/browser/navigation_controller.h" |
32 #include "content/public/browser/navigation_entry.h" | 34 #include "content/public/browser/navigation_entry.h" |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 WebContents* web_contents = browser->GetSelectedWebContents(); | 660 WebContents* web_contents = browser->GetSelectedWebContents(); |
659 if (web_contents) | 661 if (web_contents) |
660 job_title = web_contents->GetTitle(); | 662 job_title = web_contents->GetTitle(); |
661 } | 663 } |
662 profile = browser->profile(); | 664 profile = browser->profile(); |
663 } else { | 665 } else { |
664 std::vector<Profile*> loaded_profiles = | 666 std::vector<Profile*> loaded_profiles = |
665 g_browser_process->profile_manager()->GetLoadedProfiles(); | 667 g_browser_process->profile_manager()->GetLoadedProfiles(); |
666 DCHECK_GT(loaded_profiles.size(), 0U); | 668 DCHECK_GT(loaded_profiles.size(), 0U); |
667 profile = loaded_profiles[0]; | 669 profile = loaded_profiles[0]; |
668 browser = BrowserList::GetLastActiveWithProfile(profile); | 670 browser = browser::FindLastActiveWithProfile(profile); |
669 } | 671 } |
670 DCHECK(profile); | 672 DCHECK(profile); |
671 PrefService* pref_service = profile->GetPrefs(); | 673 PrefService* pref_service = profile->GetPrefs(); |
672 DCHECK(pref_service); | 674 DCHECK(pref_service); |
673 if (!pref_service->FindPreference(prefs::kCloudPrintDialogWidth)) { | 675 if (!pref_service->FindPreference(prefs::kCloudPrintDialogWidth)) { |
674 pref_service->RegisterIntegerPref(prefs::kCloudPrintDialogWidth, | 676 pref_service->RegisterIntegerPref(prefs::kCloudPrintDialogWidth, |
675 kDefaultWidth, | 677 kDefaultWidth, |
676 PrefService::UNSYNCABLE_PREF); | 678 PrefService::UNSYNCABLE_PREF); |
677 } | 679 } |
678 if (!pref_service->FindPreference(prefs::kCloudPrintDialogHeight)) { | 680 if (!pref_service->FindPreference(prefs::kCloudPrintDialogHeight)) { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 file_type, | 802 file_type, |
801 false, | 803 false, |
802 delete_on_close); | 804 delete_on_close); |
803 return true; | 805 return true; |
804 } | 806 } |
805 } | 807 } |
806 return false; | 808 return false; |
807 } | 809 } |
808 | 810 |
809 } // end namespace | 811 } // end namespace |
OLD | NEW |