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

Side by Side Diff: extensions/browser/content_verify_job.cc

Issue 266963003: Beginning of support for extension content verification (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: oops, forgot to upload minor cosmetic changes to test Created 6 years, 7 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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "extensions/browser/content_verify_job.h"
6
7 #include <algorithm>
8
9 #include "base/stl_util.h"
10 #include "base/task_runner_util.h"
11 #include "content/public/browser/browser_thread.h"
12
13 namespace extensions {
14
15 namespace {
16
17 ContentVerifyJob::TestDelegate* g_test_delegate = NULL;
18
19 } // namespace
20
21 ContentVerifyJob::ContentVerifyJob(const std::string& extension_id,
22 const FailureCallback& failure_callback)
23 : extension_id_(extension_id), failure_callback_(failure_callback) {
24 }
25
26 ContentVerifyJob::~ContentVerifyJob() {
27 }
28
29 void ContentVerifyJob::Start() {
30 }
31
32 void ContentVerifyJob::BytesRead(int count, const char* data) {
33 if (g_test_delegate) {
34 FailureReason reason =
35 g_test_delegate->BytesRead(extension_id_, count, data);
36 if (reason != NONE)
37 return DispatchFailureCallback(reason);
Yoyo Zhou 2014/05/07 02:25:59 Why are we returning from a void?
asargent_no_longer_on_chrome 2014/05/07 06:56:42 Just a shorthand for: if (reason != NONE) { Dis
38 }
39 }
40
41 void ContentVerifyJob::DoneReading() {
42 if (g_test_delegate) {
43 FailureReason reason = g_test_delegate->DoneReading(extension_id_);
44 if (reason != NONE)
45 return DispatchFailureCallback(reason);
46 }
47 }
48
49 // static
50 void ContentVerifyJob::SetDelegateForTests(TestDelegate* delegate) {
51 g_test_delegate = delegate;
52 }
53
54 void ContentVerifyJob::DispatchFailureCallback(FailureReason reason) {
55 if (!failure_callback_.is_null()) {
56 failure_callback_.Run(reason);
57 failure_callback_.Reset();
58 }
59 }
60
61 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698