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_
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "net/url_request/url_fetcher_delegate.h"
21 class URLRequestContextGetter
;
24 namespace extensions
{
26 class WebstoreDataFetcherDelegate
;
28 // WebstoreDataFetcher fetches web store data and parses it into a
30 class WebstoreDataFetcher
: public base::SupportsWeakPtr
<WebstoreDataFetcher
>,
31 public net::URLFetcherDelegate
{
33 WebstoreDataFetcher(WebstoreDataFetcherDelegate
* delegate
,
34 net::URLRequestContextGetter
* request_context
,
35 const GURL
& referrer_url
,
36 const std::string webstore_item_id
);
37 virtual ~WebstoreDataFetcher();
42 void OnJsonParseSuccess(scoped_ptr
<base::Value
> parsed_json
);
43 void OnJsonParseFailure(const std::string
& error
);
45 // net::URLFetcherDelegate overrides:
46 virtual void OnURLFetchComplete(const net::URLFetcher
* source
) OVERRIDE
;
48 WebstoreDataFetcherDelegate
* delegate_
;
49 net::URLRequestContextGetter
* request_context_
;
53 // For fetching webstore JSON data.
54 scoped_ptr
<net::URLFetcher
> webstore_data_url_fetcher_
;
56 DISALLOW_COPY_AND_ASSIGN(WebstoreDataFetcher
);
59 } // namespace extensions
61 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_DATA_FETCHER_H_