| 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/ui/views/database_open_info_view.h" | 5 #include "chrome/browser/ui/views/database_open_info_view.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "grit/generated_resources.h" | 9 #include "grit/generated_resources.h" |
| 10 #include "ui/base/text/bytes_formatting.h" |
| 10 | 11 |
| 11 namespace { | 12 namespace { |
| 12 const int kInfoLabelIds[] = { | 13 const int kInfoLabelIds[] = { |
| 13 IDS_COOKIES_COOKIE_DOMAIN_LABEL, | 14 IDS_COOKIES_COOKIE_DOMAIN_LABEL, |
| 14 IDS_COOKIES_WEB_DATABASE_NAME, | 15 IDS_COOKIES_WEB_DATABASE_NAME, |
| 15 IDS_COOKIES_WEB_DATABASE_DESCRIPTION_LABEL, | 16 IDS_COOKIES_WEB_DATABASE_DESCRIPTION_LABEL, |
| 16 IDS_COOKIES_SIZE_LABEL | 17 IDS_COOKIES_SIZE_LABEL |
| 17 }; | 18 }; |
| 18 } // namespace | 19 } // namespace |
| 19 | 20 |
| 20 /////////////////////////////////////////////////////////////////////////////// | 21 /////////////////////////////////////////////////////////////////////////////// |
| 21 // DatabaseOpenInfoView, public: | 22 // DatabaseOpenInfoView, public: |
| 22 | 23 |
| 23 DatabaseOpenInfoView::DatabaseOpenInfoView() | 24 DatabaseOpenInfoView::DatabaseOpenInfoView() |
| 24 : GenericInfoView(ARRAYSIZE(kInfoLabelIds), kInfoLabelIds) { | 25 : GenericInfoView(ARRAYSIZE(kInfoLabelIds), kInfoLabelIds) { |
| 25 } | 26 } |
| 26 | 27 |
| 27 void DatabaseOpenInfoView::SetFields(const std::string& host, | 28 void DatabaseOpenInfoView::SetFields(const std::string& host, |
| 28 const string16& database_name, | 29 const string16& database_name, |
| 29 const string16& display_name, | 30 const string16& display_name, |
| 30 unsigned long estimated_size) { | 31 unsigned long estimated_size) { |
| 31 string16 url = UTF8ToUTF16(host); | 32 string16 url = UTF8ToUTF16(host); |
| 32 string16 size = FormatBytes(estimated_size, | 33 string16 size = ui::FormatBytes(estimated_size); |
| 33 GetByteDisplayUnits(estimated_size), | |
| 34 true); | |
| 35 int row = 0; | 34 int row = 0; |
| 36 SetValue(row++, url); | 35 SetValue(row++, url); |
| 37 SetValue(row++, database_name); | 36 SetValue(row++, database_name); |
| 38 SetValue(row++, display_name); | 37 SetValue(row++, display_name); |
| 39 SetValue(row++, size); | 38 SetValue(row++, size); |
| 40 } | 39 } |
| OLD | NEW |