[M67 Dev][EWK] Classify EWK APIs by public, internal, or product
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / efl_integration / browser / web_cache_efl / web_cache_manager_efl.h
1 // Copyright 2014 Samsung Electronics. All rights reseoved.
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 WEB_CACHE_MANAGER_EFL_H
6 #define WEB_CACHE_MANAGER_EFL_H
7
8 #include <set>
9
10 #include "base/compiler_specific.h"
11 #include "base/memory/singleton.h"
12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h"
14 #include "public/ewk_context.h"
15
16 namespace content {
17 class BrowserContext;
18 }
19 struct CacheParamsEfl;
20
21 class WebCacheManagerEfl : public content::NotificationObserver {
22  public:
23   explicit WebCacheManagerEfl(content::BrowserContext* browser_context);
24   virtual ~WebCacheManagerEfl();
25
26   // content::NotificationObserver implementation:
27   virtual void Observe(int type,
28                        const content::NotificationSource& source,
29                        const content::NotificationDetails& details) override;
30   void ClearCache();
31   void SetCacheModel(Ewk_Cache_Model model);
32   Ewk_Cache_Model GetCacheModel() const { return cache_model_; }
33   void SetBrowserContext(content::BrowserContext* browser_context);
34
35  private:
36   static void CalculateCacheSizes(Ewk_Cache_Model cache_model, int64_t memory_size, int64_t disk_free_size,
37       int64_t* cache_total_capacity, int64_t* cache_min_dead_capacity,
38       int64_t* cache_max_dead_capacity, double* dead_decoded_data_deletion_interval,
39       int64_t* page_cache_capacity, int64_t* url_cache_memory_capacity,
40       int64_t* url_cache_disk_capacity);
41
42   CacheParamsEfl GetCacheParamsFromModel(Ewk_Cache_Model);
43   void SetRenderProcessCacheModel(Ewk_Cache_Model model, int render_process_id);
44
45   content::NotificationRegistrar registrar_;
46   std::set<int> renderers_;
47   content::BrowserContext* browser_context_;
48   Ewk_Cache_Model cache_model_;
49   DISALLOW_COPY_AND_ASSIGN(WebCacheManagerEfl);
50 };
51
52 #endif
53