OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_frame/chrome_frame_automation.h" | 5 #include "chrome_frame/chrome_frame_automation.h" |
6 | 6 |
7 #include "app/app_switches.h" | 7 #include "app/app_switches.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/file_version_info.h" | 13 #include "base/file_version_info.h" |
| 14 #include "base/lazy_instance.h" |
14 #include "base/lock.h" | 15 #include "base/lock.h" |
15 #include "base/logging.h" | 16 #include "base/logging.h" |
16 #include "base/path_service.h" | 17 #include "base/path_service.h" |
17 #include "base/process_util.h" | 18 #include "base/process_util.h" |
18 #include "base/singleton.h" | |
19 #include "base/string_util.h" | 19 #include "base/string_util.h" |
20 #include "base/sys_info.h" | 20 #include "base/sys_info.h" |
21 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
22 #include "base/waitable_event.h" | 22 #include "base/waitable_event.h" |
23 #include "chrome/app/client_util.h" | 23 #include "chrome/app/client_util.h" |
24 #include "chrome/common/chrome_constants.h" | 24 #include "chrome/common/chrome_constants.h" |
25 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
26 #include "chrome/test/automation/tab_proxy.h" | 26 #include "chrome/test/automation/tab_proxy.h" |
27 #include "chrome_frame/chrome_launcher_utils.h" | 27 #include "chrome_frame/chrome_launcher_utils.h" |
28 #include "chrome_frame/crash_reporting/crash_metrics.h" | 28 #include "chrome_frame/crash_reporting/crash_metrics.h" |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 entry); | 562 entry); |
563 proxies_.container().erase(it); | 563 proxies_.container().erase(it); |
564 lock_.Release(); | 564 lock_.Release(); |
565 } | 565 } |
566 | 566 |
567 entry->Release(); | 567 entry->Release(); |
568 | 568 |
569 return true; | 569 return true; |
570 } | 570 } |
571 | 571 |
572 Singleton<ProxyFactory, LeakySingletonTraits<ProxyFactory> > g_proxy_factory; | 572 static base::LazyInstance<ProxyFactory, |
| 573 base::LeakyLazyInstanceTraits<ProxyFactory> > |
| 574 g_proxy_factory(base::LINKER_INITIALIZED); |
573 | 575 |
574 template <> struct RunnableMethodTraits<ChromeFrameAutomationClient> { | 576 template <> struct RunnableMethodTraits<ChromeFrameAutomationClient> { |
575 static void RetainCallee(ChromeFrameAutomationClient* obj) {} | 577 static void RetainCallee(ChromeFrameAutomationClient* obj) {} |
576 static void ReleaseCallee(ChromeFrameAutomationClient* obj) {} | 578 static void ReleaseCallee(ChromeFrameAutomationClient* obj) {} |
577 }; | 579 }; |
578 | 580 |
579 ChromeFrameAutomationClient::ChromeFrameAutomationClient() | 581 ChromeFrameAutomationClient::ChromeFrameAutomationClient() |
580 : chrome_frame_delegate_(NULL), | 582 : chrome_frame_delegate_(NULL), |
581 chrome_window_(NULL), | 583 chrome_window_(NULL), |
582 tab_window_(NULL), | 584 tab_window_(NULL), |
583 parent_window_(NULL), | 585 parent_window_(NULL), |
584 automation_server_(NULL), | 586 automation_server_(NULL), |
585 automation_server_id_(NULL), | 587 automation_server_id_(NULL), |
586 ui_thread_id_(NULL), | 588 ui_thread_id_(NULL), |
587 init_state_(UNINITIALIZED), | 589 init_state_(UNINITIALIZED), |
588 use_chrome_network_(false), | 590 use_chrome_network_(false), |
589 proxy_factory_(g_proxy_factory.get()), | 591 proxy_factory_(g_proxy_factory.Pointer()), |
590 handle_top_level_requests_(false), | 592 handle_top_level_requests_(false), |
591 tab_handle_(-1), | 593 tab_handle_(-1), |
592 session_id_(-1), | 594 session_id_(-1), |
593 external_tab_cookie_(0), | 595 external_tab_cookie_(0), |
594 url_fetcher_(NULL), | 596 url_fetcher_(NULL), |
595 url_fetcher_flags_(PluginUrlRequestManager::NOT_THREADSAFE), | 597 url_fetcher_flags_(PluginUrlRequestManager::NOT_THREADSAFE), |
596 navigate_after_initialization_(false), | 598 navigate_after_initialization_(false), |
597 route_all_top_level_navigations_(false) { | 599 route_all_top_level_navigations_(false) { |
598 } | 600 } |
599 | 601 |
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1474 const URLRequestStatus& status) { | 1476 const URLRequestStatus& status) { |
1475 automation_server_->Send(new AutomationMsg_RequestEnd(0, tab_->handle(), | 1477 automation_server_->Send(new AutomationMsg_RequestEnd(0, tab_->handle(), |
1476 request_id, status)); | 1478 request_id, status)); |
1477 } | 1479 } |
1478 | 1480 |
1479 void ChromeFrameAutomationClient::OnCookiesRetrieved(bool success, | 1481 void ChromeFrameAutomationClient::OnCookiesRetrieved(bool success, |
1480 const GURL& url, const std::string& cookie_string, int cookie_id) { | 1482 const GURL& url, const std::string& cookie_string, int cookie_id) { |
1481 automation_server_->Send(new AutomationMsg_GetCookiesHostResponse(0, | 1483 automation_server_->Send(new AutomationMsg_GetCookiesHostResponse(0, |
1482 tab_->handle(), success, url, cookie_string, cookie_id)); | 1484 tab_->handle(), success, url, cookie_string, cookie_id)); |
1483 } | 1485 } |
OLD | NEW |