Remove keyboard_ui.css and manifest_keyboard.json
[chromium-blink-merge.git] / chrome / browser / extensions / webstore_data_fetcher.h
blobd75b9999aef1fc3ad96dc9ba2afeb81b1d6ce3cd
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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_WEBSTORE_DATA_FETCHER_H_
6 #define CHROME_BROWSER_EXTENSIONS_WEBSTORE_DATA_FETCHER_H_
8 #include <string>
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "net/url_request/url_fetcher_delegate.h"
13 #include "url/gurl.h"
15 namespace base {
16 class Value;
19 namespace net {
20 class URLFetcher;
21 class URLRequestContextGetter;
24 namespace extensions {
26 class WebstoreDataFetcherDelegate;
28 // WebstoreDataFetcher fetches web store data and parses it into a
29 // DictionaryValue.
30 class WebstoreDataFetcher : public base::SupportsWeakPtr<WebstoreDataFetcher>,
31 public net::URLFetcherDelegate {
32 public:
33 WebstoreDataFetcher(WebstoreDataFetcherDelegate* delegate,
34 net::URLRequestContextGetter* request_context,
35 const GURL& referrer_url,
36 const std::string webstore_item_id);
37 ~WebstoreDataFetcher() override;
39 void Start();
41 void set_max_auto_retries(int max_retries) {
42 max_auto_retries_ = max_retries;
45 private:
46 void OnJsonParseSuccess(scoped_ptr<base::Value> parsed_json);
47 void OnJsonParseFailure(const std::string& error);
49 // net::URLFetcherDelegate overrides:
50 void OnURLFetchComplete(const net::URLFetcher* source) override;
52 WebstoreDataFetcherDelegate* delegate_;
53 net::URLRequestContextGetter* request_context_;
54 GURL referrer_url_;
55 std::string id_;
57 // For fetching webstore JSON data.
58 scoped_ptr<net::URLFetcher> webstore_data_url_fetcher_;
60 // Maximum auto retry times on server 5xx error or ERR_NETWORK_CHANGED.
61 // Default is 0 which means to use the URLFetcher default behavior.
62 int max_auto_retries_;
64 DISALLOW_COPY_AND_ASSIGN(WebstoreDataFetcher);
67 } // namespace extensions
69 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_DATA_FETCHER_H_