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/extensions/api/management/management_api.h" | 5 #include "chrome/browser/extensions/api/management/management_api.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 base::Bind(&SafeManifestJSONParser::StartWorkOnIOThread, this)); | 373 base::Bind(&SafeManifestJSONParser::StartWorkOnIOThread, this)); |
374 } | 374 } |
375 | 375 |
376 void StartWorkOnIOThread() { | 376 void StartWorkOnIOThread() { |
377 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 377 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
378 UtilityProcessHost* host = UtilityProcessHost::Create( | 378 UtilityProcessHost* host = UtilityProcessHost::Create( |
379 this, base::MessageLoopProxy::current().get()); | 379 this, base::MessageLoopProxy::current().get()); |
380 host->Send(new ChromeUtilityMsg_ParseJSON(manifest_)); | 380 host->Send(new ChromeUtilityMsg_ParseJSON(manifest_)); |
381 } | 381 } |
382 | 382 |
383 virtual bool OnMessageReceived(const IPC::Message& message) override { | 383 bool OnMessageReceived(const IPC::Message& message) override { |
384 bool handled = true; | 384 bool handled = true; |
385 IPC_BEGIN_MESSAGE_MAP(SafeManifestJSONParser, message) | 385 IPC_BEGIN_MESSAGE_MAP(SafeManifestJSONParser, message) |
386 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ParseJSON_Succeeded, | 386 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ParseJSON_Succeeded, |
387 OnJSONParseSucceeded) | 387 OnJSONParseSucceeded) |
388 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ParseJSON_Failed, | 388 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ParseJSON_Failed, |
389 OnJSONParseFailed) | 389 OnJSONParseFailed) |
390 IPC_MESSAGE_UNHANDLED(handled = false) | 390 IPC_MESSAGE_UNHANDLED(handled = false) |
391 IPC_END_MESSAGE_MAP() | 391 IPC_END_MESSAGE_MAP() |
392 return handled; | 392 return handled; |
393 } | 393 } |
(...skipping 25 matching lines...) Expand all Loading... |
419 | 419 |
420 void ReportResultFromUIThread() { | 420 void ReportResultFromUIThread() { |
421 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 421 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
422 if (error_.empty() && parsed_manifest_.get()) | 422 if (error_.empty() && parsed_manifest_.get()) |
423 client_->OnParseSuccess(parsed_manifest_.Pass()); | 423 client_->OnParseSuccess(parsed_manifest_.Pass()); |
424 else | 424 else |
425 client_->OnParseFailure(error_); | 425 client_->OnParseFailure(error_); |
426 } | 426 } |
427 | 427 |
428 private: | 428 private: |
429 virtual ~SafeManifestJSONParser() {} | 429 ~SafeManifestJSONParser() override {} |
430 | 430 |
431 // The client who we'll report results back to. | 431 // The client who we'll report results back to. |
432 ManagementGetPermissionWarningsByManifestFunction* client_; | 432 ManagementGetPermissionWarningsByManifestFunction* client_; |
433 | 433 |
434 // Data to parse. | 434 // Data to parse. |
435 std::string manifest_; | 435 std::string manifest_; |
436 | 436 |
437 // Results of parsing. | 437 // Results of parsing. |
438 scoped_ptr<base::DictionaryValue> parsed_manifest_; | 438 scoped_ptr<base::DictionaryValue> parsed_manifest_; |
439 | 439 |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 void ManagementAPI::OnListenerAdded(const EventListenerInfo& details) { | 1020 void ManagementAPI::OnListenerAdded(const EventListenerInfo& details) { |
1021 // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. | 1021 // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. |
1022 tracked_objects::ScopedProfile tracking_profile( | 1022 tracked_objects::ScopedProfile tracking_profile( |
1023 FROM_HERE_WITH_EXPLICIT_FUNCTION("ManagementAPI::OnListenerAdded")); | 1023 FROM_HERE_WITH_EXPLICIT_FUNCTION("ManagementAPI::OnListenerAdded")); |
1024 | 1024 |
1025 management_event_router_.reset(new ManagementEventRouter(browser_context_)); | 1025 management_event_router_.reset(new ManagementEventRouter(browser_context_)); |
1026 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 1026 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
1027 } | 1027 } |
1028 | 1028 |
1029 } // namespace extensions | 1029 } // namespace extensions |
OLD | NEW |