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

Side by Side Diff: chrome/browser/extensions/extension_web_socket_proxy_private_api.cc

Issue 7812036: Update base/timer.h code to pass through Location from call sites. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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
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/extensions/extension_web_socket_proxy_private_api.h" 5 #include "chrome/browser/extensions/extension_web_socket_proxy_private_api.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "chrome/browser/internal_auth.h" 10 #include "chrome/browser/internal_auth.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 StringValue* passport = Value::CreateStringValue( 53 StringValue* passport = Value::CreateStringValue(
54 browser::InternalAuthGeneration::GeneratePassport( 54 browser::InternalAuthGeneration::GeneratePassport(
55 "web_socket_proxy", map)); 55 "web_socket_proxy", map));
56 result_.reset(passport); 56 result_.reset(passport);
57 } 57 }
58 #endif // defined(OS_CHROMEOS) 58 #endif // defined(OS_CHROMEOS)
59 59
60 if (delay_response) { 60 if (delay_response) {
61 const int kTimeout = 3; 61 const int kTimeout = 3;
62 timer_.Start(base::TimeDelta::FromSeconds(kTimeout), 62 timer_.Start(base::TimeDelta::FromSeconds(kTimeout),
63 this, &WebSocketProxyPrivateGetPassportForTCPFunction::Finalize); 63 this, &WebSocketProxyPrivateGetPassportForTCPFunction::Finalize,
64 FROM_HERE);
64 } else { 65 } else {
65 Finalize(); 66 Finalize();
66 } 67 }
67 return true; 68 return true;
68 } 69 }
69 70
70 void WebSocketProxyPrivateGetPassportForTCPFunction::Observe( 71 void WebSocketProxyPrivateGetPassportForTCPFunction::Observe(
71 int type, const NotificationSource& source, 72 int type, const NotificationSource& source,
72 const NotificationDetails& details) { 73 const NotificationDetails& details) {
73 #if defined(OS_CHROMEOS) 74 #if defined(OS_CHROMEOS)
74 DCHECK(type == chrome::NOTIFICATION_WEB_SOCKET_PROXY_STARTED); 75 DCHECK(type == chrome::NOTIFICATION_WEB_SOCKET_PROXY_STARTED);
75 #else 76 #else
76 NOTREACHED(); 77 NOTREACHED();
77 #endif 78 #endif
78 timer_.Stop(); // Cancel timeout timer. 79 timer_.Stop(); // Cancel timeout timer.
79 Finalize(); 80 Finalize();
80 } 81 }
81 82
82 void WebSocketProxyPrivateGetPassportForTCPFunction::Finalize() { 83 void WebSocketProxyPrivateGetPassportForTCPFunction::Finalize() {
83 if (is_finalized_) { 84 if (is_finalized_) {
84 NOTREACHED(); 85 NOTREACHED();
85 return; 86 return;
86 } 87 }
87 is_finalized_ = true; 88 is_finalized_ = true;
88 SendResponse(true); 89 SendResponse(true);
89 Release(); 90 Release();
90 } 91 }
91 92
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698