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

Unified Diff: chrome/browser/translate/translate_url_fetcher.h

Issue 131463002: Move TranslateURLFetcher to the translate component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix translate.gypi for real Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/translate/translate_script.cc ('k') | chrome/browser/translate/translate_url_fetcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/translate/translate_url_fetcher.h
diff --git a/chrome/browser/translate/translate_url_fetcher.h b/chrome/browser/translate/translate_url_fetcher.h
deleted file mode 100644
index b7d89035dacaec99596bec4ef2f998bbcf777b46..0000000000000000000000000000000000000000
--- a/chrome/browser/translate/translate_url_fetcher.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_TRANSLATE_TRANSLATE_URL_FETCHER_H_
-#define CHROME_BROWSER_TRANSLATE_TRANSLATE_URL_FETCHER_H_
-
-#include "base/callback.h"
-#include "base/memory/scoped_ptr.h"
-#include "net/url_request/url_fetcher_delegate.h"
-#include "url/gurl.h"
-
-class TranslateURLFetcher : public net::URLFetcherDelegate {
- public:
- // Callback type for Request().
- typedef base::Callback<void(int, bool, const std::string&)> Callback;
-
- // Represents internal state if the fetch is completed successfully.
- enum State {
- IDLE, // No fetch request was issued.
- REQUESTING, // A fetch request was issued, but not finished yet.
- COMPLETED, // The last fetch request was finished successfully.
- FAILED, // The last fetch request was finished with a failure.
- };
-
- explicit TranslateURLFetcher(int id);
- virtual ~TranslateURLFetcher();
-
- int max_retry_on_5xx() {
- return max_retry_on_5xx_;
- }
- void set_max_retry_on_5xx(int count) {
- max_retry_on_5xx_ = count;
- }
-
- const std::string& extra_request_header() {
- return extra_request_header_;
- }
- void set_extra_request_header(const std::string& header) {
- extra_request_header_ = header;
- }
-
- // Requests to |url|. |callback| will be invoked when the function returns
- // true, and the request is finished asynchronously.
- // Returns false if the previous request is not finished, or the request
- // is omitted due to retry limitation.
- bool Request(const GURL& url, const Callback& callback);
-
- // Gets internal state.
- State state() { return state_; }
-
- // net::URLFetcherDelegate implementation:
- virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
-
- private:
- // URL to send the request.
- GURL url_;
-
- // ID which is assigned to the URLFetcher.
- const int id_;
-
- // Internal state.
- enum State state_;
-
- // URLFetcher instance.
- scoped_ptr<net::URLFetcher> fetcher_;
-
- // Callback passed at Request(). It will be invoked when an asynchronous
- // fetch operation is finished.
- Callback callback_;
-
- // Counts how many times did it try to fetch the language list.
- int retry_count_;
-
- // Max number how many times to retry on the server error
- int max_retry_on_5xx_;
-
- // An extra HTTP request header
- std::string extra_request_header_;
-
- DISALLOW_COPY_AND_ASSIGN(TranslateURLFetcher);
-};
-
-#endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_URL_FETCHER_H_
« no previous file with comments | « chrome/browser/translate/translate_script.cc ('k') | chrome/browser/translate/translate_url_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698