Home | History | Annotate | Download | only in browser
      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.
      4 
      5 #ifndef CONTENT_SHELL_BROWSER_SHELL_MESSAGE_FILTER_H_
      6 #define CONTENT_SHELL_BROWSER_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 class GURL;
     16 
     17 namespace net {
     18 class URLRequestContextGetter;
     19 }
     20 
     21 namespace storage {
     22 class QuotaManager;
     23 }
     24 
     25 namespace storage {
     26 class DatabaseTracker;
     27 }
     28 
     29 namespace content {
     30 
     31 class ShellMessageFilter : public BrowserMessageFilter {
     32  public:
     33   ShellMessageFilter(int render_process_id,
     34                      storage::DatabaseTracker* database_tracker,
     35                      storage::QuotaManager* quota_manager,
     36                      net::URLRequestContextGetter* request_context_getter);
     37 
     38  private:
     39   virtual ~ShellMessageFilter();
     40 
     41   // BrowserMessageFilter implementation.
     42   virtual void OverrideThreadForMessage(const IPC::Message& message,
     43                                         BrowserThread::ID* thread) OVERRIDE;
     44   virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
     45 
     46   void OnReadFileToString(const base::FilePath& local_file,
     47                           std::string* contents);
     48   void OnRegisterIsolatedFileSystem(
     49       const std::vector<base::FilePath>& absolute_filenames,
     50       std::string* filesystem_id);
     51   void OnClearAllDatabases();
     52   void OnSetDatabaseQuota(int quota);
     53   void OnCheckWebNotificationPermission(const GURL& origin, int* result);
     54   void OnGrantWebNotificationPermission(const GURL& origin,
     55                                         bool permission_granted);
     56   void OnClearWebNotificationPermissions();
     57   void OnAcceptAllCookies(bool accept);
     58   void OnDeleteAllCookies();
     59 
     60   int render_process_id_;
     61 
     62   storage::DatabaseTracker* database_tracker_;
     63   storage::QuotaManager* quota_manager_;
     64   net::URLRequestContextGetter* request_context_getter_;
     65 
     66   DISALLOW_COPY_AND_ASSIGN(ShellMessageFilter);
     67 };
     68 
     69 }  // namespace content
     70 
     71 #endif // CONTENT_SHELL_BROWSER_SHELL_MESSAGE_FILTER_H_
     72