Page Speed Optimization Libraries  1.4.26.1
net/instaweb/http/public/fake_url_async_fetcher.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2010 Google Inc.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *      http:///www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00021 
00022 #ifndef NET_INSTAWEB_HTTP_PUBLIC_FAKE_URL_ASYNC_FETCHER_H_
00023 #define NET_INSTAWEB_HTTP_PUBLIC_FAKE_URL_ASYNC_FETCHER_H_
00024 
00025 #include "net/instaweb/http/public/url_pollable_async_fetcher.h"
00026 #include "net/instaweb/util/public/basictypes.h"
00027 #include "net/instaweb/util/public/string.h"
00028 
00029 namespace net_instaweb {
00030 
00031 class AsyncFetch;
00032 class MessageHandler;
00033 class UrlFetcher;
00034 
00041 class FakeUrlAsyncFetcher : public UrlPollableAsyncFetcher {
00042  public:
00043   explicit FakeUrlAsyncFetcher(UrlFetcher* url_fetcher)
00044       : url_fetcher_(url_fetcher),
00045         fetcher_supports_https_(true) {
00046   }
00047   virtual ~FakeUrlAsyncFetcher();
00048 
00049   virtual bool SupportsHttps() const { return fetcher_supports_https_; }
00050 
00051   virtual void Fetch(const GoogleString& url,
00052                      MessageHandler* message_handler,
00053                      AsyncFetch* fetch);
00054 
00057   virtual int Poll(int64 max_wait_ms) { return 0; }
00058 
00059   void set_fetcher_supports_https(bool val) { fetcher_supports_https_ = val; }
00060 
00061  private:
00062   UrlFetcher* url_fetcher_;
00063   bool fetcher_supports_https_;
00064 
00065   DISALLOW_COPY_AND_ASSIGN(FakeUrlAsyncFetcher);
00066 };
00067 
00068 }  
00069 
00070 #endif  ///< NET_INSTAWEB_HTTP_PUBLIC_FAKE_URL_ASYNC_FETCHER_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines