OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/extensions/api/automation_internal/automation_internal_
api.h" | 5 #include "chrome/browser/extensions/api/automation_internal/automation_internal_
api.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "chrome/browser/extensions/api/automation_internal/automation_action_ad
apter.h" | 10 #include "chrome/browser/extensions/api/automation_internal/automation_action_ad
apter.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 const GURL& url = contents->GetURL(); | 53 const GURL& url = contents->GetURL(); |
54 // TODO(aboxhall): check for webstore URL | 54 // TODO(aboxhall): check for webstore URL |
55 if (automation_info->matches.MatchesURL(url)) | 55 if (automation_info->matches.MatchesURL(url)) |
56 return true; | 56 return true; |
57 | 57 |
58 int tab_id = ExtensionTabUtil::GetTabId(contents); | 58 int tab_id = ExtensionTabUtil::GetTabId(contents); |
59 content::RenderProcessHost* process = contents->GetRenderProcessHost(); | 59 content::RenderProcessHost* process = contents->GetRenderProcessHost(); |
60 int process_id = process ? process->GetID() : -1; | 60 int process_id = process ? process->GetID() : -1; |
61 std::string unused_error; | 61 std::string unused_error; |
62 return extension->permissions_data()->CanExecuteScriptOnPage( | 62 return extension->permissions_data()->CanAccessPage( |
63 extension, url, url, tab_id, NULL, process_id, &unused_error); | 63 extension, url, url, tab_id, process_id, &unused_error); |
64 } | 64 } |
65 | 65 |
66 // Helper class that receives accessibility data from |WebContents|. | 66 // Helper class that receives accessibility data from |WebContents|. |
67 class AutomationWebContentsObserver | 67 class AutomationWebContentsObserver |
68 : public content::WebContentsObserver, | 68 : public content::WebContentsObserver, |
69 public content::WebContentsUserData<AutomationWebContentsObserver> { | 69 public content::WebContentsUserData<AutomationWebContentsObserver> { |
70 public: | 70 public: |
71 virtual ~AutomationWebContentsObserver() {} | 71 virtual ~AutomationWebContentsObserver() {} |
72 | 72 |
73 // content::WebContentsObserver overrides. | 73 // content::WebContentsObserver overrides. |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 return RespondNow(Error("desktop permission must be requested")); | 241 return RespondNow(Error("desktop permission must be requested")); |
242 | 242 |
243 AutomationManagerAsh::GetInstance()->Enable(browser_context()); | 243 AutomationManagerAsh::GetInstance()->Enable(browser_context()); |
244 return RespondNow(NoArguments()); | 244 return RespondNow(NoArguments()); |
245 #else | 245 #else |
246 return RespondNow(Error("getDesktop is unsupported by this platform")); | 246 return RespondNow(Error("getDesktop is unsupported by this platform")); |
247 #endif // defined(OS_CHROMEOS) | 247 #endif // defined(OS_CHROMEOS) |
248 } | 248 } |
249 | 249 |
250 } // namespace extensions | 250 } // namespace extensions |
OLD | NEW |