| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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_EXTENSIONS_EXTENSION_RENDERER_STATE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_RENDERER_STATE_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_RENDERER_STATE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_RENDERER_STATE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 // Looks up the tab and window ID for a given request. Returns true if we have | 31 // Looks up the tab and window ID for a given request. Returns true if we have |
| 32 // the IDs in our map. Called on the IO thread. | 32 // the IDs in our map. Called on the IO thread. |
| 33 bool GetTabAndWindowId( | 33 bool GetTabAndWindowId( |
| 34 const content::ResourceRequestInfo* info, int* tab_id, int* window_id); | 34 const content::ResourceRequestInfo* info, int* tab_id, int* window_id); |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 class RenderViewHostObserver; | 37 class RenderViewHostObserver; |
| 38 class TabObserver; | 38 class TabObserver; |
| 39 friend class TabObserver; | 39 friend class TabObserver; |
| 40 friend struct DefaultSingletonTraits<ExtensionRendererState>; | 40 friend struct base::DefaultSingletonTraits<ExtensionRendererState>; |
| 41 | 41 |
| 42 typedef std::pair<int, int> RenderId; | 42 typedef std::pair<int, int> RenderId; |
| 43 typedef std::pair<int, int> TabAndWindowId; | 43 typedef std::pair<int, int> TabAndWindowId; |
| 44 typedef std::map<RenderId, TabAndWindowId> TabAndWindowIdMap; | 44 typedef std::map<RenderId, TabAndWindowId> TabAndWindowIdMap; |
| 45 | 45 |
| 46 ExtensionRendererState(); | 46 ExtensionRendererState(); |
| 47 ~ExtensionRendererState(); | 47 ~ExtensionRendererState(); |
| 48 | 48 |
| 49 // Adds or removes a render view from our map. | 49 // Adds or removes a render view from our map. |
| 50 void SetTabAndWindowId( | 50 void SetTabAndWindowId( |
| 51 int render_process_host_id, int routing_id, int tab_id, int window_id); | 51 int render_process_host_id, int routing_id, int tab_id, int window_id); |
| 52 void ClearTabAndWindowId( | 52 void ClearTabAndWindowId( |
| 53 int render_process_host_id, int routing_id); | 53 int render_process_host_id, int routing_id); |
| 54 | 54 |
| 55 TabObserver* observer_; | 55 TabObserver* observer_; |
| 56 TabAndWindowIdMap map_; | 56 TabAndWindowIdMap map_; |
| 57 | 57 |
| 58 DISALLOW_COPY_AND_ASSIGN(ExtensionRendererState); | 58 DISALLOW_COPY_AND_ASSIGN(ExtensionRendererState); |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_RENDERER_STATE_H_ | 61 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_RENDERER_STATE_H_ |
| OLD | NEW |