Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(495)

Side by Side Diff: chrome/browser/printing/print_dialog_cloud.cc

Issue 7616011: Fix call to GetDefaultBrowser in print cloud because we are no longer guaranteed to have a Defaul... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/json/json_reader.h" 11 #include "base/json/json_reader.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/browser_process_impl.h"
14 #include "chrome/browser/debugger/devtools_window.h" 15 #include "chrome/browser/debugger/devtools_window.h"
15 #include "chrome/browser/prefs/pref_service.h" 16 #include "chrome/browser/prefs/pref_service.h"
16 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" 17 #include "chrome/browser/printing/cloud_print/cloud_print_url.h"
17 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/profiles/profile_manager.h" 19 #include "chrome/browser/profiles/profile_manager.h"
19 #include "chrome/browser/ui/browser_dialogs.h" 20 #include "chrome/browser/ui/browser_dialogs.h"
20 #include "chrome/browser/ui/browser_list.h" 21 #include "chrome/browser/ui/browser_list.h"
21 #include "chrome/common/chrome_switches.h" 22 #include "chrome/common/chrome_switches.h"
22 #include "chrome/common/pref_names.h" 23 #include "chrome/common/pref_names.h"
23 #include "chrome/common/print_messages.h" 24 #include "chrome/common/print_messages.h"
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 const int kDefaultWidth = 497; 529 const int kDefaultWidth = 497;
529 const int kDefaultHeight = 332; 530 const int kDefaultHeight = 332;
530 string16 job_title = print_job_title; 531 string16 job_title = print_job_title;
531 Profile* profile = NULL; 532 Profile* profile = NULL;
532 if (modal) { 533 if (modal) {
533 DCHECK(browser); 534 DCHECK(browser);
534 if (job_title.empty() && browser->GetSelectedTabContents()) 535 if (job_title.empty() && browser->GetSelectedTabContents())
535 job_title = browser->GetSelectedTabContents()->GetTitle(); 536 job_title = browser->GetSelectedTabContents()->GetTitle();
536 profile = browser->GetProfile(); 537 profile = browser->GetProfile();
537 } else { 538 } else {
538 profile = ProfileManager::GetDefaultProfile(); 539 std::vector<Profile*> loaded_profiles =
540 g_browser_process->profile_manager()->GetLoadedProfiles();
541 DCHECK_GT(loaded_profiles.size(), 0U);
542 profile = loaded_profiles[0];
539 } 543 }
540 DCHECK(profile); 544 DCHECK(profile);
541 PrefService* pref_service = profile->GetPrefs(); 545 PrefService* pref_service = profile->GetPrefs();
542 DCHECK(pref_service); 546 DCHECK(pref_service);
543 if (!pref_service->FindPreference(prefs::kCloudPrintDialogWidth)) { 547 if (!pref_service->FindPreference(prefs::kCloudPrintDialogWidth)) {
544 pref_service->RegisterIntegerPref(prefs::kCloudPrintDialogWidth, 548 pref_service->RegisterIntegerPref(prefs::kCloudPrintDialogWidth,
545 kDefaultWidth, 549 kDefaultWidth,
546 PrefService::UNSYNCABLE_PREF); 550 PrefService::UNSYNCABLE_PREF);
547 } 551 }
548 if (!pref_service->FindPreference(prefs::kCloudPrintDialogHeight)) { 552 if (!pref_service->FindPreference(prefs::kCloudPrintDialogHeight)) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 print_job_title, 632 print_job_title,
629 file_type, 633 file_type,
630 false); 634 false);
631 return true; 635 return true;
632 } 636 }
633 } 637 }
634 return false; 638 return false;
635 } 639 }
636 640
637 } // end namespace 641 } // end namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698