| OLD | NEW |
| 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/remoting/setup_flow.h" | 5 #include "chrome/browser/remoting/setup_flow.h" |
| 6 | 6 |
| 7 #include "app/gfx/font_util.h" | |
| 8 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 9 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 10 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 11 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 12 #include "base/values.h" | 11 #include "base/values.h" |
| 13 #include "chrome/browser/browser_thread.h" | 12 #include "chrome/browser/browser_thread.h" |
| 14 #include "chrome/browser/prefs/pref_service.h" | 13 #include "chrome/browser/prefs/pref_service.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/remoting/remoting_resources_source.h" | 15 #include "chrome/browser/remoting/remoting_resources_source.h" |
| 17 #include "chrome/browser/remoting/setup_flow_login_step.h" | 16 #include "chrome/browser/remoting/setup_flow_login_step.h" |
| 18 #include "chrome/browser/renderer_host/render_view_host.h" | 17 #include "chrome/browser/renderer_host/render_view_host.h" |
| 19 #include "chrome/browser/tab_contents/tab_contents.h" | 18 #include "chrome/browser/tab_contents/tab_contents.h" |
| 20 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
| 21 #include "chrome/browser/ui/browser_list.h" | 20 #include "chrome/browser/ui/browser_list.h" |
| 22 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
| 23 #include "gfx/font.h" | 22 #include "gfx/font.h" |
| 24 #include "grit/generated_resources.h" | 23 #include "grit/generated_resources.h" |
| 25 #include "grit/locale_settings.h" | 24 #include "grit/locale_settings.h" |
| 25 #include "ui/base/l10n/l10n_font_util.h" |
| 26 | 26 |
| 27 namespace remoting { | 27 namespace remoting { |
| 28 | 28 |
| 29 static const wchar_t kDoneIframeXPath[] = L"//iframe[@id='done']"; | 29 static const wchar_t kDoneIframeXPath[] = L"//iframe[@id='done']"; |
| 30 static const wchar_t kErrorIframeXPath[] = L"//iframe[@id='error']"; | 30 static const wchar_t kErrorIframeXPath[] = L"//iframe[@id='error']"; |
| 31 | 31 |
| 32 SetupFlowStep::SetupFlowStep() { } | 32 SetupFlowStep::SetupFlowStep() { } |
| 33 SetupFlowStep::~SetupFlowStep() { } | 33 SetupFlowStep::~SetupFlowStep() { } |
| 34 | 34 |
| 35 SetupFlowStepBase::SetupFlowStepBase() | 35 SetupFlowStepBase::SetupFlowStepBase() |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 handlers->push_back(const_cast<SetupFlow*>(this)); | 162 handlers->push_back(const_cast<SetupFlow*>(this)); |
| 163 } | 163 } |
| 164 | 164 |
| 165 void SetupFlow::GetDialogSize(gfx::Size* size) const { | 165 void SetupFlow::GetDialogSize(gfx::Size* size) const { |
| 166 PrefService* prefs = profile_->GetPrefs(); | 166 PrefService* prefs = profile_->GetPrefs(); |
| 167 gfx::Font approximate_web_font( | 167 gfx::Font approximate_web_font( |
| 168 UTF8ToUTF16(prefs->GetString(prefs::kWebKitSansSerifFontFamily)), | 168 UTF8ToUTF16(prefs->GetString(prefs::kWebKitSansSerifFontFamily)), |
| 169 prefs->GetInteger(prefs::kWebKitDefaultFontSize)); | 169 prefs->GetInteger(prefs::kWebKitDefaultFontSize)); |
| 170 | 170 |
| 171 // TODO(pranavk) Replace the following SYNC resources with REMOTING Resources. | 171 // TODO(pranavk) Replace the following SYNC resources with REMOTING Resources. |
| 172 *size = gfx::GetLocalizedContentsSizeForFont( | 172 *size = ui::GetLocalizedContentsSizeForFont( |
| 173 IDS_SYNC_SETUP_WIZARD_WIDTH_CHARS, | 173 IDS_SYNC_SETUP_WIZARD_WIDTH_CHARS, |
| 174 IDS_SYNC_SETUP_WIZARD_HEIGHT_LINES, | 174 IDS_SYNC_SETUP_WIZARD_HEIGHT_LINES, |
| 175 approximate_web_font); | 175 approximate_web_font); |
| 176 } | 176 } |
| 177 | 177 |
| 178 // A callback to notify the delegate that the dialog closed. | 178 // A callback to notify the delegate that the dialog closed. |
| 179 void SetupFlow::OnDialogClosed(const std::string& json_retval) { | 179 void SetupFlow::OnDialogClosed(const std::string& json_retval) { |
| 180 if (current_step_ != NULL) | 180 if (current_step_ != NULL) |
| 181 current_step_->Cancel(); | 181 current_step_->Cancel(); |
| 182 } | 182 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 BrowserThread::PostTask( | 259 BrowserThread::PostTask( |
| 260 BrowserThread::UI, FROM_HERE, | 260 BrowserThread::UI, FROM_HERE, |
| 261 new DeleteTask<SetupFlowStep>(current_step_.release())); | 261 new DeleteTask<SetupFlowStep>(current_step_.release())); |
| 262 } | 262 } |
| 263 | 263 |
| 264 current_step_.reset(next_step); | 264 current_step_.reset(next_step); |
| 265 StartCurrentStep(); | 265 StartCurrentStep(); |
| 266 } | 266 } |
| 267 | 267 |
| 268 } // namespace remoting | 268 } // namespace remoting |
| OLD | NEW |