OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_DEBUGGER_DEVTOOLS_WINDOW_H_ | 5 #ifndef CHROME_BROWSER_DEBUGGER_DEVTOOLS_WINDOW_H_ |
6 #define CHROME_BROWSER_DEBUGGER_DEVTOOLS_WINDOW_H_ | 6 #define CHROME_BROWSER_DEBUGGER_DEVTOOLS_WINDOW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // Overridden from DevToolsClientHost. | 80 // Overridden from DevToolsClientHost. |
81 virtual void InspectedContentsClosing() OVERRIDE; | 81 virtual void InspectedContentsClosing() OVERRIDE; |
82 virtual void ContentsReplaced(content::WebContents* new_contents) OVERRIDE; | 82 virtual void ContentsReplaced(content::WebContents* new_contents) OVERRIDE; |
83 content::RenderViewHost* GetRenderViewHost(); | 83 content::RenderViewHost* GetRenderViewHost(); |
84 | 84 |
85 void Show(DevToolsToggleAction action); | 85 void Show(DevToolsToggleAction action); |
86 | 86 |
87 TabContents* tab_contents() { return tab_contents_; } | 87 TabContents* tab_contents() { return tab_contents_; } |
88 Browser* browser() { return browser_; } // For tests. | 88 Browser* browser() { return browser_; } // For tests. |
89 DevToolsDockSide dock_side() { return dock_side_; } | 89 DevToolsDockSide dock_side() { return dock_side_; } |
90 content::DevToolsClientHost* devtools_client_host() { | 90 content::DevToolsClientHost* devtools_client_host() { return frontend_host_; } |
91 return frontend_host_; | 91 |
92 } | 92 // Returns preferred devtools window width for given |container_width|. It |
| 93 // tries to use the saved window width, or, if none exists, 1/3 of the |
| 94 // container width, then clamps to try and ensure both devtools and content |
| 95 // are at least somewhat visible. |
| 96 // Called only for the case when devtools window is docked to the side. |
| 97 int GetWidth(int container_width); |
| 98 |
| 99 // Returns preferred devtools window height for given |container_height|. |
| 100 // Uses the same logic as GetWidth. |
| 101 // Called only for the case when devtools window is docked to bottom. |
| 102 int GetHeight(int container_height); |
| 103 |
| 104 // Stores preferred devtools window width for this instance. |
| 105 void SetWidth(int width); |
| 106 |
| 107 // Stores preferred devtools window height for this instance. |
| 108 void SetHeight(int height); |
93 | 109 |
94 private: | 110 private: |
95 static DevToolsWindow* Create(Profile* profile, | 111 static DevToolsWindow* Create(Profile* profile, |
96 content::RenderViewHost* inspected_rvh, | 112 content::RenderViewHost* inspected_rvh, |
97 DevToolsDockSide dock_side, | 113 DevToolsDockSide dock_side, |
98 bool shared_worker_frontend); | 114 bool shared_worker_frontend); |
99 DevToolsWindow(TabContents* tab_contents, | 115 DevToolsWindow(TabContents* tab_contents, |
100 Profile* profile, | 116 Profile* profile, |
101 content::RenderViewHost* inspected_rvh, | 117 content::RenderViewHost* inspected_rvh, |
102 DevToolsDockSide dock_side); | 118 DevToolsDockSide dock_side); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 Profile* profile_; | 192 Profile* profile_; |
177 TabContents* inspected_tab_; | 193 TabContents* inspected_tab_; |
178 TabContents* tab_contents_; | 194 TabContents* tab_contents_; |
179 Browser* browser_; | 195 Browser* browser_; |
180 DevToolsDockSide dock_side_; | 196 DevToolsDockSide dock_side_; |
181 bool is_loaded_; | 197 bool is_loaded_; |
182 DevToolsToggleAction action_on_load_; | 198 DevToolsToggleAction action_on_load_; |
183 content::NotificationRegistrar registrar_; | 199 content::NotificationRegistrar registrar_; |
184 content::DevToolsClientHost* frontend_host_; | 200 content::DevToolsClientHost* frontend_host_; |
185 scoped_ptr<DevToolsFileHelper> file_helper_; | 201 scoped_ptr<DevToolsFileHelper> file_helper_; |
| 202 int width_; |
| 203 int height_; |
186 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); | 204 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); |
187 }; | 205 }; |
188 | 206 |
189 #endif // CHROME_BROWSER_DEBUGGER_DEVTOOLS_WINDOW_H_ | 207 #endif // CHROME_BROWSER_DEBUGGER_DEVTOOLS_WINDOW_H_ |
OLD | NEW |