OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_PAGE_INFO_MODEL_H_ | 5 #ifndef CHROME_BROWSER_PAGE_INFO_MODEL_H_ |
6 #define CHROME_BROWSER_PAGE_INFO_MODEL_H_ | 6 #define CHROME_BROWSER_PAGE_INFO_MODEL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
12 #include "chrome/browser/cancelable_request.h" | 12 #include "chrome/browser/cancelable_request.h" |
13 #include "chrome/browser/history/history.h" | 13 #include "chrome/browser/history/history.h" |
14 #include "chrome/browser/tab_contents/navigation_entry.h" | 14 #include "chrome/browser/tab_contents/navigation_entry.h" |
15 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
16 | 16 |
17 class PrefService; | 17 class PrefService; |
18 class Profile; | 18 class Profile; |
19 | 19 |
20 // The model that provides the information that should be displayed in the page | 20 // The model that provides the information that should be displayed in the page |
21 // info dialog/bubble. | 21 // info dialog. |
22 class PageInfoModel { | 22 class PageInfoModel { |
23 public: | 23 public: |
24 class PageInfoModelObserver { | 24 class PageInfoModelObserver { |
25 public: | 25 public: |
26 virtual void ModelChanged() = 0; | 26 virtual void ModelChanged() = 0; |
27 | 27 |
28 protected: | 28 protected: |
29 virtual ~PageInfoModelObserver() {} | 29 virtual ~PageInfoModelObserver() {} |
30 }; | 30 }; |
31 | 31 |
32 enum SectionInfoType { | |
33 SECTION_INFO_IDENTITY = 0, | |
34 SECTION_INFO_CONNECTION, | |
35 SECTION_INFO_FIRST_VISIT, | |
36 }; | |
37 | |
38 struct SectionInfo { | 32 struct SectionInfo { |
39 SectionInfo(bool state, | 33 SectionInfo(bool state, |
40 const string16& title, | 34 const string16& title, |
41 const string16& headline, | 35 const string16& head_line, |
42 const string16& description, | 36 const string16& description) |
43 SectionInfoType type) | |
44 : state(state), | 37 : state(state), |
45 title(title), | 38 title(title), |
46 headline(headline), | 39 head_line(head_line), |
47 description(description), | 40 description(description) { |
48 type(type) { | |
49 } | 41 } |
50 | 42 |
51 bool state; // True if state is OK, false otherwise (ex of bad states: | 43 bool state; // True if state is OK, false otherwise (ex of bad states: |
52 // unverified identity over HTTPS). | 44 // unverified identity over HTTPS). |
53 | 45 |
54 // The title of the section. | 46 // The title of the section. |
55 string16 title; | 47 string16 title; |
56 | 48 |
57 // A single line describing the section, optional. | 49 // A single line describing the section, optional. |
58 string16 headline; | 50 string16 head_line; |
59 | 51 |
60 // The full description of what this section is. | 52 // The full description of what this section is. |
61 string16 description; | 53 string16 description; |
62 | |
63 // The type of SectionInfo we are dealing with, for example: Identity, | |
64 // Connection, First Visit. | |
65 SectionInfoType type; | |
66 }; | 54 }; |
67 | 55 |
68 PageInfoModel(Profile* profile, | 56 PageInfoModel(Profile* profile, |
69 const GURL& url, | 57 const GURL& url, |
70 const NavigationEntry::SSLStatus& ssl, | 58 const NavigationEntry::SSLStatus& ssl, |
71 bool show_history, | 59 bool show_history, |
72 PageInfoModelObserver* observer); | 60 PageInfoModelObserver* observer); |
73 | 61 |
74 int GetSectionCount(); | 62 int GetSectionCount(); |
75 SectionInfo GetSectionInfo(int index); | 63 SectionInfo GetSectionInfo(int index); |
(...skipping 15 matching lines...) Expand all Loading... |
91 std::vector<SectionInfo> sections_; | 79 std::vector<SectionInfo> sections_; |
92 | 80 |
93 // Used to request number of visits. | 81 // Used to request number of visits. |
94 CancelableRequestConsumer request_consumer_; | 82 CancelableRequestConsumer request_consumer_; |
95 | 83 |
96 private: | 84 private: |
97 DISALLOW_COPY_AND_ASSIGN(PageInfoModel); | 85 DISALLOW_COPY_AND_ASSIGN(PageInfoModel); |
98 }; | 86 }; |
99 | 87 |
100 #endif // CHROME_BROWSER_PAGE_INFO_MODEL_H_ | 88 #endif // CHROME_BROWSER_PAGE_INFO_MODEL_H_ |
OLD | NEW |