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/custom_handlers/protocol_handler_registry.h" | 5 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 ~FakeProtocolClientWorker() override {} | 227 ~FakeProtocolClientWorker() override {} |
228 | 228 |
229 ShellIntegration::DefaultWebClientState CheckIsDefault() override { | 229 ShellIntegration::DefaultWebClientState CheckIsDefault() override { |
230 if (force_failure_) { | 230 if (force_failure_) { |
231 return ShellIntegration::NOT_DEFAULT; | 231 return ShellIntegration::NOT_DEFAULT; |
232 } else { | 232 } else { |
233 return ShellIntegration::IS_DEFAULT; | 233 return ShellIntegration::IS_DEFAULT; |
234 } | 234 } |
235 } | 235 } |
236 | 236 |
237 bool SetAsDefault(bool interactive_permitted) override { return true; } | 237 void SetAsDefault(bool interactive_permitted) override { |
| 238 BrowserThread::PostTask( |
| 239 BrowserThread::UI, FROM_HERE, |
| 240 base::Bind(&FakeProtocolClientWorker::CompleteSetAsDefault, this, |
| 241 true)); |
| 242 } |
238 | 243 |
239 private: | 244 private: |
240 bool force_failure_; | 245 bool force_failure_; |
241 }; | 246 }; |
242 | 247 |
243 ProtocolHandlerRegistry::DefaultClientObserver* | 248 ProtocolHandlerRegistry::DefaultClientObserver* |
244 FakeDelegate::CreateShellObserver(ProtocolHandlerRegistry* registry) { | 249 FakeDelegate::CreateShellObserver(ProtocolHandlerRegistry* registry) { |
245 return new FakeClientObserver(registry, this); | 250 return new FakeClientObserver(registry, this); |
246 } | 251 } |
247 | 252 |
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 // added to pref. | 1127 // added to pref. |
1123 ASSERT_EQ(InPrefIgnoredHandlerCount(), 2); | 1128 ASSERT_EQ(InPrefIgnoredHandlerCount(), 2); |
1124 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4); | 1129 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4); |
1125 | 1130 |
1126 registry()->RemoveIgnoredHandler(p2u1); | 1131 registry()->RemoveIgnoredHandler(p2u1); |
1127 | 1132 |
1128 // p2u1 installed by user and policy, so it is removed from pref alone. | 1133 // p2u1 installed by user and policy, so it is removed from pref alone. |
1129 ASSERT_EQ(InPrefIgnoredHandlerCount(), 1); | 1134 ASSERT_EQ(InPrefIgnoredHandlerCount(), 1); |
1130 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4); | 1135 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4); |
1131 } | 1136 } |
OLD | NEW |