| Index: tools/chrome_remote_control/chrome_remote_control/browser.py
|
| diff --git a/tools/chrome_remote_control/chrome_remote_control/browser.py b/tools/chrome_remote_control/chrome_remote_control/browser.py
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f7ba1b9f0f3de9d4bfa67ebe05ac1c9501b14dbe
|
| --- /dev/null
|
| +++ b/tools/chrome_remote_control/chrome_remote_control/browser.py
|
| @@ -0,0 +1,44 @@
|
| +# Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +# Use of this source code is governed by a BSD-style license that can be
|
| +# found in the LICENSE file.
|
| +import os as real_os
|
| +import sys as real_sys
|
| +import subprocess as real_subprocess
|
| +import urllib2
|
| +import json
|
| +import tab
|
| +
|
| +import browser_finder
|
| +
|
| +class Browser(object):
|
| + """A running browser instance that can be controled in a limited way.
|
| +
|
| + To create a browser instance, use browser_finder.FindBestPossibleBrowser.
|
| +
|
| + Be sure to clean up after yourself by calling Close() when you are done with
|
| + the browser. Or better yet:
|
| + browser_to_create = FindBestPossibleBrowser(options)
|
| + with browser_to_create.Create() as browser:
|
| + ... do all your operations on browser here
|
| + """
|
| + def __init__(self, backend):
|
| + self._backend = backend
|
| +
|
| + def __enter__(self):
|
| + return self
|
| +
|
| + def __exit__(self, *args):
|
| + self.Close()
|
| +
|
| + @property
|
| + def num_tabs(self):
|
| + return self._backend.num_tabs
|
| +
|
| + def GetNthTabURL(self, index):
|
| + return self._backend.GetNthTabURL(index)
|
| +
|
| + def ConnectToNthTab(self, index):
|
| + return self._backend.ConnectToNthTab(index)
|
| +
|
| + def Close(self):
|
| + self._backend.Close()
|
|
|