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

Side by Side Diff: chrome/browser/profile_resetter/jtl_interpreter.h

Issue 271673006: Eliminate all code related to the AutomaticProfileResetter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nit from dbeam@, using new tracked preference deprecation. Created 6 years, 4 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 2013 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 #ifndef CHROME_BROWSER_PROFILE_RESETTER_JTL_INTERPRETER_H_
6 #define CHROME_BROWSER_PROFILE_RESETTER_JTL_INTERPRETER_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/values.h"
12
13 // Executes a JTL program on a given dictionary.
14 //
15 // JTL (Json Traversal Language) programs are defined in jtl_foundation.h
16 class JtlInterpreter {
17 public:
18 enum Result {
19 OK,
20 PARSE_ERROR,
21 RUNTIME_ERROR,
22 RESULT_MAX,
23 };
24
25 // |hasher_seed| is a value used in jtl_foundation::Hasher. All node names,
26 // strings, integers and doubles are hashed before being compared to hash
27 // values listed in |program|.
28 // |program| is a byte array containing a JTL program.
29 // |input| is a dictionary on which the program is evaluated.
30 JtlInterpreter(const std::string& hasher_seed,
31 const std::string& program,
32 const base::DictionaryValue* input);
33 ~JtlInterpreter();
34
35 void Execute();
36
37 Result result() const { return result_; }
38 const base::DictionaryValue* working_memory() const {
39 return working_memory_.get();
40 }
41 bool GetOutputBoolean(const std::string& unhashed_key, bool* output) const;
42 bool GetOutputString(const std::string& unhashed_key,
43 std::string* output) const;
44
45 // Generates a checksum of the loaded program, defined as the first 3 bytes of
46 // the program's SHA-256 hash interpreted as a big-endian integer.
47 int CalculateProgramChecksum() const;
48
49 private:
50 // Input.
51 std::string hasher_seed_;
52 std::string program_;
53 const base::DictionaryValue* input_;
54 // Output.
55 scoped_ptr<base::DictionaryValue> working_memory_;
56 Result result_;
57
58 DISALLOW_COPY_AND_ASSIGN(JtlInterpreter);
59 };
60
61 #endif // CHROME_BROWSER_PROFILE_RESETTER_JTL_INTERPRETER_H_
OLDNEW
« no previous file with comments | « chrome/browser/profile_resetter/jtl_instructions.h ('k') | chrome/browser/profile_resetter/jtl_interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698