Chromium Code Reviews| 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 import urllib2 | 5 import urllib2 |
| 6 import httplib | 6 import httplib |
| 7 import socket | 7 import socket |
| 8 import json | 8 import json |
| 9 import re | 9 import re |
| 10 import weakref | 10 import weakref |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 self._UpdateTabList() | 36 self._UpdateTabList() |
| 37 | 37 |
| 38 def New(self, timeout=None): | 38 def New(self, timeout=None): |
| 39 self._browser_backend.Request('new', timeout=timeout) | 39 self._browser_backend.Request('new', timeout=timeout) |
| 40 return self[-1] | 40 return self[-1] |
| 41 | 41 |
| 42 def DoesDebuggerUrlExist(self, url): | 42 def DoesDebuggerUrlExist(self, url): |
| 43 self._UpdateTabList() | 43 self._UpdateTabList() |
| 44 return url in self._tab_list | 44 return url in self._tab_list |
| 45 | 45 |
| 46 def ActivateTab(self, debugger_url, timeout=None): | |
| 47 """Activates a tab. | |
| 48 | |
|
nduca
2012/12/21 22:15:23
This doesn't make sense on the tab controller.
br
Danh Nguyen
2012/12/26 19:13:04
Done.
Danh Nguyen
2012/12/26 19:13:04
Done. I'm moving this function to tab.py as you s
dtu
2012/12/27 18:57:25
This is actually similar to how Close() works. tab
| |
| 49 Args: | |
| 50 debugger_url: webSocketDebuggerUrl of the tab. | |
| 51 """ | |
| 52 tab_id = debugger_url.split('/')[-1] | |
| 53 try: | |
| 54 response = self._browser_backend.Request('activate/%s' % tab_id, | |
| 55 timeout=timeout) | |
| 56 except urllib2.HTTPError: | |
| 57 raise Exception('Unable to activate tab, tab id not found: %s' % tab_id) | |
| 58 assert response == 'Target activated' | |
| 59 self._UpdateTabList() | |
| 60 | |
| 46 def CloseTab(self, debugger_url, timeout=None): | 61 def CloseTab(self, debugger_url, timeout=None): |
| 47 # TODO(dtu): crbug.com/160946, allow closing the last tab on some platforms. | 62 # TODO(dtu): crbug.com/160946, allow closing the last tab on some platforms. |
| 48 # For now, just create a new tab before closing the last tab. | 63 # For now, just create a new tab before closing the last tab. |
| 49 if len(self) <= 1: | 64 if len(self) <= 1: |
| 50 self.New() | 65 self.New() |
| 51 | 66 |
| 52 tab_id = debugger_url.split('/')[-1] | 67 tab_id = debugger_url.split('/')[-1] |
| 53 try: | 68 try: |
| 54 response = self._browser_backend.Request('close/%s' % tab_id, | 69 response = self._browser_backend.Request('close/%s' % tab_id, |
| 55 timeout=timeout) | 70 timeout=timeout) |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 return self._tracing_backend.GetTraceAndReset() | 226 return self._tracing_backend.GetTraceAndReset() |
| 212 | 227 |
| 213 def CreateForwarder(self, host_port): | 228 def CreateForwarder(self, host_port): |
| 214 raise NotImplementedError() | 229 raise NotImplementedError() |
| 215 | 230 |
| 216 def IsBrowserRunning(self): | 231 def IsBrowserRunning(self): |
| 217 raise NotImplementedError() | 232 raise NotImplementedError() |
| 218 | 233 |
| 219 def GetStandardOutput(self): | 234 def GetStandardOutput(self): |
| 220 raise NotImplementedError() | 235 raise NotImplementedError() |
| OLD | NEW |