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

Side by Side Diff: remoting/host/setup/win/auth_code_getter.cc

Issue 121123002: Update uses of UTF conversions in ppapi/, printing/, remoting/, rlz/, sandbox/, skia/, sql/, sync/,… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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 | « remoting/host/setup/daemon_installer_win.cc ('k') | remoting/host/verify_config_window_win.cc » ('j') | 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) 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 "remoting/host/setup/win/auth_code_getter.h" 5 #include "remoting/host/setup/win/auth_code_getter.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "base/win/scoped_bstr.h" 9 #include "base/win/scoped_bstr.h"
10 #include "base/win/scoped_variant.h" 10 #include "base/win/scoped_variant.h"
(...skipping 20 matching lines...) Expand all
31 on_auth_code.Run(""); 31 on_auth_code.Run("");
32 return; 32 return;
33 } 33 }
34 on_auth_code_ = on_auth_code; 34 on_auth_code_ = on_auth_code;
35 HRESULT hr = browser_.CreateInstance(CLSID_InternetExplorer, NULL, 35 HRESULT hr = browser_.CreateInstance(CLSID_InternetExplorer, NULL,
36 CLSCTX_LOCAL_SERVER); 36 CLSCTX_LOCAL_SERVER);
37 if (FAILED(hr)) { 37 if (FAILED(hr)) {
38 on_auth_code_.Run(""); 38 on_auth_code_.Run("");
39 return; 39 return;
40 } 40 }
41 base::win::ScopedBstr url(UTF8ToWide( 41 base::win::ScopedBstr url(base::UTF8ToWide(
42 GetOauthStartUrl(GetDefaultOauthRedirectUrl())).c_str()); 42 GetOauthStartUrl(GetDefaultOauthRedirectUrl())).c_str());
43 base::win::ScopedVariant empty_variant; 43 base::win::ScopedVariant empty_variant;
44 hr = browser_->Navigate(url, empty_variant.AsInput(), empty_variant.AsInput(), 44 hr = browser_->Navigate(url, empty_variant.AsInput(), empty_variant.AsInput(),
45 empty_variant.AsInput(), empty_variant.AsInput()); 45 empty_variant.AsInput(), empty_variant.AsInput());
46 if (FAILED(hr)) { 46 if (FAILED(hr)) {
47 KillBrowser(); 47 KillBrowser();
48 on_auth_code_.Run(""); 48 on_auth_code_.Run("");
49 return; 49 return;
50 } 50 }
51 browser_->put_Visible(VARIANT_TRUE); 51 browser_->put_Visible(VARIANT_TRUE);
(...skipping 17 matching lines...) Expand all
69 *auth_code = ""; 69 *auth_code = "";
70 if (!browser_) { 70 if (!browser_) {
71 return true; 71 return true;
72 } 72 }
73 base::win::ScopedBstr url; 73 base::win::ScopedBstr url;
74 HRESULT hr = browser_->get_LocationName(url.Receive()); 74 HRESULT hr = browser_->get_LocationName(url.Receive());
75 if (!SUCCEEDED(hr)) { 75 if (!SUCCEEDED(hr)) {
76 KillBrowser(); 76 KillBrowser();
77 return true; 77 return true;
78 } 78 }
79 *auth_code = GetOauthCodeInUrl(WideToUTF8(static_cast<BSTR>(url)), 79 *auth_code = GetOauthCodeInUrl(base::WideToUTF8(static_cast<BSTR>(url)),
80 GetDefaultOauthRedirectUrl()); 80 GetDefaultOauthRedirectUrl());
81 if (!auth_code->empty()) { 81 if (!auth_code->empty()) {
82 KillBrowser(); 82 KillBrowser();
83 return true; 83 return true;
84 } 84 }
85 return false; 85 return false;
86 } 86 }
87 87
88 void AuthCodeGetter::KillBrowser() { 88 void AuthCodeGetter::KillBrowser() {
89 if (browser_) { 89 if (browser_) {
90 browser_->Quit(); 90 browser_->Quit();
91 browser_.Release(); 91 browser_.Release();
92 } 92 }
93 } 93 }
94 94
95 } // namespace remoting 95 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/setup/daemon_installer_win.cc ('k') | remoting/host/verify_config_window_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698