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 #include "chrome/test/chromedriver/session.h" | 5 #include "chrome/test/chromedriver/session.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
10 #include "base/threading/thread_local.h" | 11 #include "base/threading/thread_local.h" |
11 #include "base/values.h" | 12 #include "base/values.h" |
12 #include "chrome/test/chromedriver/chrome/chrome.h" | 13 #include "chrome/test/chromedriver/chrome/chrome.h" |
13 #include "chrome/test/chromedriver/chrome/status.h" | 14 #include "chrome/test/chromedriver/chrome/status.h" |
14 #include "chrome/test/chromedriver/chrome/web_view.h" | 15 #include "chrome/test/chromedriver/chrome/web_view.h" |
15 #include "chrome/test/chromedriver/logging.h" | 16 #include "chrome/test/chromedriver/logging.h" |
16 | 17 |
17 namespace { | 18 namespace { |
(...skipping 21 matching lines...) Expand all Loading... |
39 sticky_modifiers(0), | 40 sticky_modifiers(0), |
40 mouse_position(0, 0), | 41 mouse_position(0, 0), |
41 page_load_timeout(kDefaultPageLoadTimeout), | 42 page_load_timeout(kDefaultPageLoadTimeout), |
42 auto_reporting_enabled(false) {} | 43 auto_reporting_enabled(false) {} |
43 | 44 |
44 Session::Session(const std::string& id, scoped_ptr<Chrome> chrome) | 45 Session::Session(const std::string& id, scoped_ptr<Chrome> chrome) |
45 : id(id), | 46 : id(id), |
46 quit(false), | 47 quit(false), |
47 detach(false), | 48 detach(false), |
48 force_devtools_screenshot(false), | 49 force_devtools_screenshot(false), |
49 chrome(chrome.Pass()), | 50 chrome(std::move(chrome)), |
50 sticky_modifiers(0), | 51 sticky_modifiers(0), |
51 mouse_position(0, 0), | 52 mouse_position(0, 0), |
52 page_load_timeout(kDefaultPageLoadTimeout), | 53 page_load_timeout(kDefaultPageLoadTimeout), |
53 auto_reporting_enabled(false) {} | 54 auto_reporting_enabled(false) {} |
54 | 55 |
55 Session::~Session() {} | 56 Session::~Session() {} |
56 | 57 |
57 Status Session::GetTargetWindow(WebView** web_view) { | 58 Status Session::GetTargetWindow(WebView** web_view) { |
58 if (!chrome) | 59 if (!chrome) |
59 return Status(kNoSuchWindow, "no chrome started in this session"); | 60 return Status(kNoSuchWindow, "no chrome started in this session"); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 return std::string(); | 113 return std::string(); |
113 } | 114 } |
114 | 115 |
115 Session* GetThreadLocalSession() { | 116 Session* GetThreadLocalSession() { |
116 return lazy_tls_session.Pointer()->Get(); | 117 return lazy_tls_session.Pointer()->Get(); |
117 } | 118 } |
118 | 119 |
119 void SetThreadLocalSession(scoped_ptr<Session> session) { | 120 void SetThreadLocalSession(scoped_ptr<Session> session) { |
120 lazy_tls_session.Pointer()->Set(session.release()); | 121 lazy_tls_session.Pointer()->Set(session.release()); |
121 } | 122 } |
OLD | NEW |