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

Side by Side Diff: chrome/browser/renderer_host/render_view_host_factory.h

Issue 3325012: Fix SessionStorage (Closed)
Patch Set: kill the last (new) dcheck Created 10 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_FACTORY_H_ 5 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_FACTORY_H_
6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_FACTORY_H_ 6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_FACTORY_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 10
11 class RenderViewHost; 11 class RenderViewHost;
12 class RenderViewHostDelegate; 12 class RenderViewHostDelegate;
13 class SessionStorageNamespace;
13 class SiteInstance; 14 class SiteInstance;
14 15
15 namespace base { 16 namespace base {
16 class WaitableEvent; 17 class WaitableEvent;
17 } // namespace base 18 } // namespace base
18 19
19 // A factory for creating RenderViewHosts. There is a global factory function 20 // A factory for creating RenderViewHosts. There is a global factory function
20 // that can be installed for the purposes of testing to provide a specialized 21 // that can be installed for the purposes of testing to provide a specialized
21 // RenderViewHost class. 22 // RenderViewHost class.
22 class RenderViewHostFactory { 23 class RenderViewHostFactory {
23 public: 24 public:
24 // Creates a RenderViewHost using the currently registered factory, or the 25 // Creates a RenderViewHost using the currently registered factory, or the
25 // default one if no factory is registered. Ownership of the returned 26 // default one if no factory is registered. Ownership of the returned
26 // pointer will be passed to the caller. 27 // pointer will be passed to the caller.
27 static RenderViewHost* Create(SiteInstance* instance, 28 static RenderViewHost* Create(SiteInstance* instance,
28 RenderViewHostDelegate* delegate, 29 RenderViewHostDelegate* delegate,
29 int routing_id, 30 int routing_id,
30 int64 session_storage_namespace_id); 31 SessionStorageNamespace* session_storage);
31 32
32 // Returns true if there is currently a globally-registered factory. 33 // Returns true if there is currently a globally-registered factory.
33 static bool has_factory() { 34 static bool has_factory() {
34 return !!factory_; 35 return !!factory_;
35 } 36 }
36 37
37 protected: 38 protected:
38 RenderViewHostFactory() {} 39 RenderViewHostFactory() {}
39 virtual ~RenderViewHostFactory() {} 40 virtual ~RenderViewHostFactory() {}
40 41
41 // You can derive from this class and specify an implementation for this 42 // You can derive from this class and specify an implementation for this
42 // function to create a different kind of RenderViewHost for testing. 43 // function to create a different kind of RenderViewHost for testing.
43 virtual RenderViewHost* CreateRenderViewHost( 44 virtual RenderViewHost* CreateRenderViewHost(
44 SiteInstance* instance, 45 SiteInstance* instance,
45 RenderViewHostDelegate* delegate, 46 RenderViewHostDelegate* delegate,
46 int routing_id, 47 int routing_id,
47 int64 session_storage_namespace_id) = 0; 48 SessionStorageNamespace* session_storage_namespace) = 0;
48 49
49 // Registers your factory to be called when new RenderViewHosts are created. 50 // Registers your factory to be called when new RenderViewHosts are created.
50 // We have only one global factory, so there must be no factory registered 51 // We have only one global factory, so there must be no factory registered
51 // before the call. This class does NOT take ownership of the pointer. 52 // before the call. This class does NOT take ownership of the pointer.
52 static void RegisterFactory(RenderViewHostFactory* factory); 53 static void RegisterFactory(RenderViewHostFactory* factory);
53 54
54 // Unregister the previously registered factory. With no factory registered, 55 // Unregister the previously registered factory. With no factory registered,
55 // the default RenderViewHosts will be created. 56 // the default RenderViewHosts will be created.
56 static void UnregisterFactory(); 57 static void UnregisterFactory();
57 58
58 private: 59 private:
59 // The current globally registered factory. This is NULL when we should 60 // The current globally registered factory. This is NULL when we should
60 // create the default RenderViewHosts. 61 // create the default RenderViewHosts.
61 static RenderViewHostFactory* factory_; 62 static RenderViewHostFactory* factory_;
62 63
63 DISALLOW_COPY_AND_ASSIGN(RenderViewHostFactory); 64 DISALLOW_COPY_AND_ASSIGN(RenderViewHostFactory);
64 }; 65 };
65 66
66 67
67 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_FACTORY_H_ 68 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_FACTORY_H_
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/render_view_host.cc ('k') | chrome/browser/renderer_host/render_view_host_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698