OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chrome_quota_permission_context.h" | 5 #include "chrome/browser/chrome_quota_permission_context.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
15 #include "chrome/browser/permissions/permission_request.h" | 15 #include "chrome/browser/permissions/permission_request.h" |
16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/tab_contents/tab_util.h" | 17 #include "chrome/browser/tab_contents/tab_util.h" |
18 #include "chrome/grit/generated_resources.h" | 18 #include "chrome/grit/generated_resources.h" |
19 #include "chrome/grit/locale_settings.h" | 19 #include "chrome/grit/locale_settings.h" |
20 #include "components/url_formatter/elide_url.h" | 20 #include "components/url_formatter/elide_url.h" |
21 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
22 #include "content/public/browser/navigation_details.h" | 22 #include "content/public/browser/navigation_details.h" |
23 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
24 #include "storage/common/quota/quota_types.h" | 24 #include "storage/common/quota/quota_types.h" |
25 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
26 #include "ui/gfx/vector_icons_public.h" | |
27 #include "url/gurl.h" | 26 #include "url/gurl.h" |
28 | 27 |
29 #if defined(OS_ANDROID) | 28 #if defined(OS_ANDROID) |
30 #include "chrome/browser/android/android_theme_resources.h" | 29 #include "chrome/browser/android/android_theme_resources.h" |
31 #include "chrome/browser/infobars/infobar_service.h" | 30 #include "chrome/browser/infobars/infobar_service.h" |
32 #include "components/infobars/core/confirm_infobar_delegate.h" | 31 #include "components/infobars/core/confirm_infobar_delegate.h" |
33 #include "components/infobars/core/infobar.h" | 32 #include "components/infobars/core/infobar.h" |
34 #else | 33 #else |
35 #include "chrome/browser/permissions/permission_request_manager.h" | 34 #include "chrome/browser/permissions/permission_request_manager.h" |
| 35 #include "ui/vector_icons/vector_icons.h" |
36 #endif | 36 #endif |
37 | 37 |
38 namespace { | 38 namespace { |
39 | 39 |
40 #if defined(OS_ANDROID) | 40 #if defined(OS_ANDROID) |
41 // If the site requested larger quota than this threshold, show a different | 41 // If the site requested larger quota than this threshold, show a different |
42 // message to the user. | 42 // message to the user. |
43 const int64_t kRequestLargeQuotaThreshold = 5 * 1024 * 1024; | 43 const int64_t kRequestLargeQuotaThreshold = 5 * 1024 * 1024; |
44 #endif | 44 #endif |
45 | 45 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 origin_url_(origin_url), | 80 origin_url_(origin_url), |
81 callback_(callback) {} | 81 callback_(callback) {} |
82 | 82 |
83 QuotaPermissionRequest::~QuotaPermissionRequest() {} | 83 QuotaPermissionRequest::~QuotaPermissionRequest() {} |
84 | 84 |
85 PermissionRequest::IconId QuotaPermissionRequest::GetIconId() const { | 85 PermissionRequest::IconId QuotaPermissionRequest::GetIconId() const { |
86 // TODO(gbillock): get the proper image here | 86 // TODO(gbillock): get the proper image here |
87 #if defined(OS_ANDROID) | 87 #if defined(OS_ANDROID) |
88 return IDR_ANDROID_INFOBAR_WARNING; | 88 return IDR_ANDROID_INFOBAR_WARNING; |
89 #else | 89 #else |
90 return gfx::VectorIconId::WARNING; | 90 return ui::kWarningIcon; |
91 #endif | 91 #endif |
92 } | 92 } |
93 | 93 |
94 base::string16 QuotaPermissionRequest::GetMessageTextFragment() const { | 94 base::string16 QuotaPermissionRequest::GetMessageTextFragment() const { |
95 return l10n_util::GetStringUTF16(IDS_REQUEST_QUOTA_PERMISSION_FRAGMENT); | 95 return l10n_util::GetStringUTF16(IDS_REQUEST_QUOTA_PERMISSION_FRAGMENT); |
96 } | 96 } |
97 | 97 |
98 GURL QuotaPermissionRequest::GetOrigin() const { | 98 GURL QuotaPermissionRequest::GetOrigin() const { |
99 return origin_url_; | 99 return origin_url_; |
100 } | 100 } |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 content::BrowserThread::IO, FROM_HERE, | 299 content::BrowserThread::IO, FROM_HERE, |
300 base::Bind(&ChromeQuotaPermissionContext::DispatchCallbackOnIOThread, | 300 base::Bind(&ChromeQuotaPermissionContext::DispatchCallbackOnIOThread, |
301 this, callback, response)); | 301 this, callback, response)); |
302 return; | 302 return; |
303 } | 303 } |
304 | 304 |
305 callback.Run(response); | 305 callback.Run(response); |
306 } | 306 } |
307 | 307 |
308 ChromeQuotaPermissionContext::~ChromeQuotaPermissionContext() {} | 308 ChromeQuotaPermissionContext::~ChromeQuotaPermissionContext() {} |
OLD | NEW |