| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/automation/automation_util.h" | 5 #include "chrome/browser/automation/automation_util.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 Browser* browser = GetBrowserAt(browser_index); | 132 Browser* browser = GetBrowserAt(browser_index); |
| 133 if (!browser || tab_index >= browser->tab_count()) | 133 if (!browser || tab_index >= browser->tab_count()) |
| 134 return NULL; | 134 return NULL; |
| 135 return browser->GetTabContentsAt(tab_index); | 135 return browser->GetTabContentsAt(tab_index); |
| 136 } | 136 } |
| 137 | 137 |
| 138 net::URLRequestContextGetter* GetRequestContext(TabContents* contents) { | 138 net::URLRequestContextGetter* GetRequestContext(TabContents* contents) { |
| 139 // Since we may be on the UI thread don't call GetURLRequestContext(). | 139 // Since we may be on the UI thread don't call GetURLRequestContext(). |
| 140 // Get the request context specific to the current TabContents and app. | 140 // Get the request context specific to the current TabContents and app. |
| 141 return contents->browser_context()->GetRequestContextForRenderProcess( | 141 return contents->browser_context()->GetRequestContextForRenderProcess( |
| 142 contents->render_view_host()->process()->id()); | 142 contents->render_view_host()->process()->GetID()); |
| 143 } | 143 } |
| 144 | 144 |
| 145 void GetCookies(const GURL& url, | 145 void GetCookies(const GURL& url, |
| 146 TabContents* contents, | 146 TabContents* contents, |
| 147 int* value_size, | 147 int* value_size, |
| 148 std::string* value) { | 148 std::string* value) { |
| 149 *value_size = -1; | 149 *value_size = -1; |
| 150 if (url.is_valid() && contents) { | 150 if (url.is_valid() && contents) { |
| 151 scoped_refptr<net::URLRequestContextGetter> context_getter = | 151 scoped_refptr<net::URLRequestContextGetter> context_getter = |
| 152 GetRequestContext(contents); | 152 GetRequestContext(contents); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 IPC::Message* message) { | 375 IPC::Message* message) { |
| 376 bool active = AppModalDialogQueue::GetInstance()->HasActiveDialog(); | 376 bool active = AppModalDialogQueue::GetInstance()->HasActiveDialog(); |
| 377 if (active) { | 377 if (active) { |
| 378 AutomationJSONReply(provider, message).SendError( | 378 AutomationJSONReply(provider, message).SendError( |
| 379 "Command cannot be performed because a modal dialog is active"); | 379 "Command cannot be performed because a modal dialog is active"); |
| 380 } | 380 } |
| 381 return active; | 381 return active; |
| 382 } | 382 } |
| 383 | 383 |
| 384 } // namespace automation_util | 384 } // namespace automation_util |
| OLD | NEW |