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

Side by Side Diff: Source/core/inspector/InspectorDatabaseAgent.h

Issue 17030009: Inspector: wrapped inspector agent instances into factory-like wrappers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed comments Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 30 matching lines...) Expand all
41 class DocumentLoader; 41 class DocumentLoader;
42 class Frame; 42 class Frame;
43 class InspectorArray; 43 class InspectorArray;
44 class InspectorDatabaseResource; 44 class InspectorDatabaseResource;
45 class InspectorFrontend; 45 class InspectorFrontend;
46 class InspectorState; 46 class InspectorState;
47 class InstrumentingAgents; 47 class InstrumentingAgents;
48 48
49 typedef String ErrorString; 49 typedef String ErrorString;
50 50
51 class InspectorDatabaseAgent : public InspectorBaseAgent<InspectorDatabaseAgent> , public InspectorBackendDispatcher::DatabaseCommandHandler { 51 class InspectorDatabaseAgent : public InspectorBaseAgent, public InspectorBacken dDispatcher::DatabaseCommandHandler {
52 public: 52 public:
53 static PassOwnPtr<InspectorDatabaseAgent> create(InstrumentingAgents* instru mentingAgents, InspectorCompositeState* state) 53 static PassRefPtr<InspectorDatabaseAgent> create(InstrumentingAgents* instru mentingAgents, InspectorState* state)
54 { 54 {
55 return adoptPtr(new InspectorDatabaseAgent(instrumentingAgents, state)); 55 return adoptRef(new InspectorDatabaseAgent(instrumentingAgents, state));
56 } 56 }
57 ~InspectorDatabaseAgent(); 57 virtual ~InspectorDatabaseAgent();
58 58
59 virtual void setFrontend(InspectorFrontend*); 59 virtual void setFrontend(InspectorFrontend*);
60 virtual void clearFrontend(); 60 virtual void clearFrontend();
61 virtual void restore(); 61 virtual void restore();
62 62
63 void didCommitLoad(Frame*, DocumentLoader*); 63 void didCommitLoad(Frame*, DocumentLoader*);
64 64
65 // Called from the front-end. 65 // Called from the front-end.
66 virtual void enable(ErrorString*); 66 virtual void enable(ErrorString*);
67 virtual void disable(ErrorString*); 67 virtual void disable(ErrorString*);
68 virtual void getDatabaseTableNames(ErrorString*, const String& databaseId, R efPtr<TypeBuilder::Array<String> >& names); 68 virtual void getDatabaseTableNames(ErrorString*, const String& databaseId, R efPtr<TypeBuilder::Array<String> >& names);
69 virtual void executeSQL(ErrorString*, const String& databaseId, const String & query, PassRefPtr<ExecuteSQLCallback>); 69 virtual void executeSQL(ErrorString*, const String& databaseId, const String & query, PassRefPtr<ExecuteSQLCallback>);
70 70
71 // Called from the injected script. 71 // Called from the injected script.
72 String databaseId(Database*); 72 String databaseId(Database*);
73 73
74 void didOpenDatabase(PassRefPtr<Database>, const String& domain, const Strin g& name, const String& version); 74 void didOpenDatabase(PassRefPtr<Database>, const String& domain, const Strin g& name, const String& version);
75 private: 75 private:
76 explicit InspectorDatabaseAgent(InstrumentingAgents*, InspectorCompositeStat e*); 76 explicit InspectorDatabaseAgent(InstrumentingAgents*, InspectorState*);
77 77
78 Database* databaseForId(const String& databaseId); 78 Database* databaseForId(const String& databaseId);
79 InspectorDatabaseResource* findByFileName(const String& fileName); 79 InspectorDatabaseResource* findByFileName(const String& fileName);
80 80
81 InspectorFrontend::Database* m_frontend; 81 InspectorFrontend::Database* m_frontend;
82 typedef HashMap<String, RefPtr<InspectorDatabaseResource> > DatabaseResource sMap; 82 typedef HashMap<String, RefPtr<InspectorDatabaseResource> > DatabaseResource sMap;
83 DatabaseResourcesMap m_resources; 83 DatabaseResourcesMap m_resources;
84 bool m_enabled; 84 bool m_enabled;
85 }; 85 };
86 86
87 class InspectorDatabaseFactory : public InspectorBaseFactory<InspectorDatabaseFa ctory, InspectorDatabaseAgent> {
88 public:
89
90 static PassOwnPtr<InspectorDatabaseFactory> create(InstrumentingAgents* inst rumentingAgents, InspectorCompositeState* compositeState)
91 {
92 return adoptPtr(new InspectorDatabaseFactory(instrumentingAgents, compos iteState));
93 }
94
95 protected:
96 InspectorDatabaseFactory(InstrumentingAgents* instrumentingAgents, Inspector CompositeState* compositeState)
97 : InspectorBaseFactory<InspectorDatabaseFactory, InspectorDatabaseAgent> ("Database", instrumentingAgents, compositeState)
98 {
99 setAgent(InspectorDatabaseAgent::create(m_instrumentingAgents, m_state)) ;
100 }
101 };
102
87 } // namespace WebCore 103 } // namespace WebCore
88 104
89 #endif // !defined(InspectorDatabaseAgent_h) 105 #endif // !defined(InspectorDatabaseAgent_h)
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorDOMStorageAgent.cpp ('k') | Source/core/inspector/InspectorDatabaseAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698