Home | History | Annotate | Download | only in shell
      1 // Copyright (c) 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 CONTENT_SHELL_SHELL_MESSAGE_FILTER_H_
      6 #define CONTENT_SHELL_SHELL_MESSAGE_FILTER_H_
      7 
      8 #include <string>
      9 #include <vector>
     10 
     11 #include "base/basictypes.h"
     12 #include "base/files/file_path.h"
     13 #include "content/public/browser/browser_message_filter.h"
     14 
     15 namespace net {
     16 class URLRequestContextGetter;
     17 }
     18 
     19 namespace quota {
     20 class QuotaManager;
     21 }
     22 
     23 namespace webkit_database {
     24 class DatabaseTracker;
     25 }
     26 
     27 namespace content {
     28 
     29 class ShellMessageFilter : public BrowserMessageFilter {
     30  public:
     31   ShellMessageFilter(int render_process_id,
     32                      webkit_database::DatabaseTracker* database_tracker,
     33                      quota::QuotaManager* quota_manager,
     34                      net::URLRequestContextGetter* request_context_getter);
     35 
     36  private:
     37   virtual ~ShellMessageFilter();
     38 
     39   // BrowserMessageFilter implementation.
     40   virtual void OverrideThreadForMessage(const IPC::Message& message,
     41                                         BrowserThread::ID* thread) OVERRIDE;
     42   virtual bool OnMessageReceived(const IPC::Message& message,
     43                                  bool* message_was_ok) OVERRIDE;
     44 
     45   void OnReadFileToString(const base::FilePath& local_file,
     46                           std::string* contents);
     47   void OnRegisterIsolatedFileSystem(
     48       const std::vector<base::FilePath>& absolute_filenames,
     49       std::string* filesystem_id);
     50   void OnClearAllDatabases();
     51   void OnSetDatabaseQuota(int quota);
     52   void OnAcceptAllCookies(bool accept);
     53   void OnDeleteAllCookies();
     54 
     55   int render_process_id_;
     56 
     57   webkit_database::DatabaseTracker* database_tracker_;
     58   quota::QuotaManager* quota_manager_;
     59   net::URLRequestContextGetter* request_context_getter_;
     60 
     61   DISALLOW_COPY_AND_ASSIGN(ShellMessageFilter);
     62 };
     63 
     64 }  // namespace content
     65 
     66 #endif // CONTENT_SHELL_SHELL_MESSAGE_FILTER_H_
     67