OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/dashboard_private/dashboard_private_api.
h" | 5 #include "chrome/browser/extensions/api/dashboard_private/dashboard_private_api.
h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
11 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" | 11 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "components/crx_file/id_util.h" | 13 #include "components/crx_file/id_util.h" |
| 14 #include "content/public/browser/storage_partition.h" |
14 #include "extensions/common/extension.h" | 15 #include "extensions/common/extension.h" |
15 #include "net/base/load_flags.h" | 16 #include "net/base/load_flags.h" |
16 #include "net/url_request/url_request.h" | 17 #include "net/url_request/url_request.h" |
17 #include "url/gurl.h" | 18 #include "url/gurl.h" |
18 | 19 |
19 namespace extensions { | 20 namespace extensions { |
20 | 21 |
21 namespace ShowPermissionPromptForDelegatedInstall = | 22 namespace ShowPermissionPromptForDelegatedInstall = |
22 api::dashboard_private::ShowPermissionPromptForDelegatedInstall; | 23 api::dashboard_private::ShowPermissionPromptForDelegatedInstall; |
23 | 24 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 if (params_->details.icon_url) { | 68 if (params_->details.icon_url) { |
68 icon_url = source_url().Resolve(*params_->details.icon_url); | 69 icon_url = source_url().Resolve(*params_->details.icon_url); |
69 if (!icon_url.is_valid()) { | 70 if (!icon_url.is_valid()) { |
70 return RespondNow(BuildResponse( | 71 return RespondNow(BuildResponse( |
71 api::dashboard_private::RESULT_INVALID_ICON_URL, | 72 api::dashboard_private::RESULT_INVALID_ICON_URL, |
72 kInvalidIconUrlError)); | 73 kInvalidIconUrlError)); |
73 } | 74 } |
74 } | 75 } |
75 | 76 |
76 net::URLRequestContextGetter* context_getter = nullptr; | 77 net::URLRequestContextGetter* context_getter = nullptr; |
77 if (!icon_url.is_empty()) | 78 if (!icon_url.is_empty()) { |
78 context_getter = browser_context()->GetRequestContext(); | 79 context_getter = |
| 80 content::BrowserContext::GetDefaultStoragePartition(browser_context())-> |
| 81 GetURLRequestContext(); |
| 82 } |
79 | 83 |
80 scoped_refptr<WebstoreInstallHelper> helper = new WebstoreInstallHelper( | 84 scoped_refptr<WebstoreInstallHelper> helper = new WebstoreInstallHelper( |
81 this, params_->details.id, params_->details.manifest, icon_url, | 85 this, params_->details.id, params_->details.manifest, icon_url, |
82 context_getter); | 86 context_getter); |
83 | 87 |
84 // The helper will call us back via OnWebstoreParseSuccess or | 88 // The helper will call us back via OnWebstoreParseSuccess or |
85 // OnWebstoreParseFailure. | 89 // OnWebstoreParseFailure. |
86 helper->Start(); | 90 helper->Start(); |
87 | 91 |
88 // Matched with a Release in OnWebstoreParseSuccess/OnWebstoreParseFailure. | 92 // Matched with a Release in OnWebstoreParseSuccess/OnWebstoreParseFailure. |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 } | 184 } |
181 | 185 |
182 std::unique_ptr<base::ListValue> | 186 std::unique_ptr<base::ListValue> |
183 DashboardPrivateShowPermissionPromptForDelegatedInstallFunction::CreateResults( | 187 DashboardPrivateShowPermissionPromptForDelegatedInstallFunction::CreateResults( |
184 api::dashboard_private::Result result) const { | 188 api::dashboard_private::Result result) const { |
185 return ShowPermissionPromptForDelegatedInstall::Results::Create(result); | 189 return ShowPermissionPromptForDelegatedInstall::Results::Create(result); |
186 } | 190 } |
187 | 191 |
188 } // namespace extensions | 192 } // namespace extensions |
189 | 193 |
OLD | NEW |