diff options
author | michaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-24 20:38:29 +0000 |
---|---|---|
committer | michaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-24 20:38:29 +0000 |
commit | 3868baed7247f13ac96e2f14f09121d43b59aab2 (patch) | |
tree | 46f15ba8f29d762b99a20c83b7011e3bb965396d /chrome/browser/views/generic_info_view.h | |
parent | 2b8e7ca060b5c7cae81676c233039c33c5ce080f (diff) | |
download | chromium_src-3868baed7247f13ac96e2f14f09121d43b59aab2.zip chromium_src-3868baed7247f13ac96e2f14f09121d43b59aab2.tar.gz chromium_src-3868baed7247f13ac96e2f14f09121d43b59aab2.tar.bz2 |
Put up a prompt to create appcaches if the Content Settings indicate to do so. Done for windows and linux (sorry mac, you're out of luck). Also put in place a GenericInfoView class.
BUG=38362
TEST=manual and generic_info_view_unittest.cc
Review URL: http://codereview.chromium.org/1115005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42525 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/generic_info_view.h')
-rw-r--r-- | chrome/browser/views/generic_info_view.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/chrome/browser/views/generic_info_view.h b/chrome/browser/views/generic_info_view.h new file mode 100644 index 0000000..ff03b14 --- /dev/null +++ b/chrome/browser/views/generic_info_view.h @@ -0,0 +1,66 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_VIEWS_GENERIC_INFO_VIEW_H_ +#define CHROME_BROWSER_VIEWS_GENERIC_INFO_VIEW_H_ + +#include "base/scoped_ptr.h" +#include "base/string16.h" +#include "testing/gtest/include/gtest/gtest_prod.h" +#include "views/view.h" + +namespace views { +class GridLayout; +class Label; +class Textfield; +} + +// GenericInfoView, displays a tabular grid of read-only textual information, +// <name, value> pairs. The fixed number of rows must be known at the time of +// construction. +class GenericInfoView : public views::View { + public: + // Constructs a info view with |number_of_rows| and populated with + // empty strings. + explicit GenericInfoView(int number_of_rows); + + // Constructs a info view with |number_of_rows|, and populates + // the name column with localized strings having the given + // |name_string_ids|. The array of ids should contain |number_of_rows| + // values and should remain valid for the life of the view. + GenericInfoView(int number_of_rows, const int name_string_ids[]); + + // The following methods should only be called after + // the view has been added to a view hierarchy. + void SetNameByStringId(int row, int id); + void SetName(int row, const string16& name); + void SetValue(int row, const string16& value); + void ClearValues() { + const string16 kEmptyString; + for (int i = 0; i < number_of_rows_; ++i) + SetValue(i, kEmptyString); + } + + protected: + // views::View override + virtual void ViewHierarchyChanged( + bool is_add, views::View* parent, views::View* child); + + private: + FRIEND_TEST(GenericInfoViewTest, GenericInfoView); + + void InitGenericInfoView(); + void AddRow(int layout_id, views::GridLayout* layout, + views::Label* name, views::Textfield* value); + + const int number_of_rows_; + const int* name_string_ids_; + scoped_array<views::Label*> name_views_; + scoped_array<views::Textfield*> value_views_; + + DISALLOW_COPY_AND_ASSIGN(GenericInfoView); +}; + +#endif // CHROME_BROWSER_VIEWS_GENERIC_INFO_VIEW_H_ + |