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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 return NULL; | 129 return NULL; |
130 Browser* browser = GetBrowserAt(browser_index); | 130 Browser* browser = GetBrowserAt(browser_index); |
131 if (!browser || tab_index >= browser->tab_count()) | 131 if (!browser || tab_index >= browser->tab_count()) |
132 return NULL; | 132 return NULL; |
133 return browser->GetTabContentsAt(tab_index); | 133 return browser->GetTabContentsAt(tab_index); |
134 } | 134 } |
135 | 135 |
136 net::URLRequestContextGetter* GetRequestContext(TabContents* contents) { | 136 net::URLRequestContextGetter* GetRequestContext(TabContents* contents) { |
137 // Since we may be on the UI thread don't call GetURLRequestContext(). | 137 // Since we may be on the UI thread don't call GetURLRequestContext(). |
138 // Get the request context specific to the current TabContents and app. | 138 // Get the request context specific to the current TabContents and app. |
139 return contents->profile()->GetRequestContextForRenderProcess( | 139 return contents->browser_context()->GetRequestContextForRenderProcess( |
140 contents->render_view_host()->process()->id()); | 140 contents->render_view_host()->process()->id()); |
141 } | 141 } |
142 | 142 |
143 void GetCookies(const GURL& url, | 143 void GetCookies(const GURL& url, |
144 TabContents* contents, | 144 TabContents* contents, |
145 int* value_size, | 145 int* value_size, |
146 std::string* value) { | 146 std::string* value) { |
147 *value_size = -1; | 147 *value_size = -1; |
148 if (url.is_valid() && contents) { | 148 if (url.is_valid() && contents) { |
149 scoped_refptr<net::URLRequestContextGetter> context_getter = | 149 scoped_refptr<net::URLRequestContextGetter> context_getter = |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 event.Wait(); | 367 event.Wait(); |
368 | 368 |
369 if (!success) { | 369 if (!success) { |
370 reply.SendError("Could not set the cookie"); | 370 reply.SendError("Could not set the cookie"); |
371 return; | 371 return; |
372 } | 372 } |
373 reply.SendSuccess(NULL); | 373 reply.SendSuccess(NULL); |
374 } | 374 } |
375 | 375 |
376 } // namespace automation_util | 376 } // namespace automation_util |
OLD | NEW |