| 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 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/image.h" |
| 17 | 17 |
| 18 class PrefService; | 18 class PrefService; |
| 19 class Profile; | 19 class Profile; |
| 20 | 20 |
| 21 // The model that provides the information that should be displayed in the page | 21 // The model that provides the information that should be displayed in the page |
| 22 // info dialog/bubble. | 22 // info dialog/bubble. |
| 23 class PageInfoModel { | 23 class PageInfoModel { |
| 24 public: | 24 public: |
| 25 class PageInfoModelObserver { | 25 class PageInfoModelObserver { |
| 26 public: | 26 public: |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // The type of SectionInfo we are dealing with, for example: Identity, | 75 // The type of SectionInfo we are dealing with, for example: Identity, |
| 76 // Connection, First Visit. | 76 // Connection, First Visit. |
| 77 SectionInfoType type; | 77 SectionInfoType type; |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 PageInfoModel(Profile* profile, | 80 PageInfoModel(Profile* profile, |
| 81 const GURL& url, | 81 const GURL& url, |
| 82 const NavigationEntry::SSLStatus& ssl, | 82 const NavigationEntry::SSLStatus& ssl, |
| 83 bool show_history, | 83 bool show_history, |
| 84 PageInfoModelObserver* observer); | 84 PageInfoModelObserver* observer); |
| 85 ~PageInfoModel(); | |
| 86 | 85 |
| 87 int GetSectionCount(); | 86 int GetSectionCount(); |
| 88 SectionInfo GetSectionInfo(int index); | 87 SectionInfo GetSectionInfo(int index); |
| 89 | 88 |
| 90 // Returns the native image type for an icon with the given id. | 89 // Returns the native image type for an icon with the given id. |
| 91 gfx::NativeImage GetIconImage(SectionStateIcon icon_id); | 90 gfx::Image* GetIconImage(SectionStateIcon icon_id); |
| 92 | 91 |
| 93 // Callback from history service with number of visits to url. | 92 // Callback from history service with number of visits to url. |
| 94 void OnGotVisitCountToHost(HistoryService::Handle handle, | 93 void OnGotVisitCountToHost(HistoryService::Handle handle, |
| 95 bool found_visits, | 94 bool found_visits, |
| 96 int count, | 95 int count, |
| 97 base::Time first_visit); | 96 base::Time first_visit); |
| 98 | 97 |
| 99 protected: | 98 protected: |
| 100 // Testing constructor. DO NOT USE. | 99 // Testing constructor. DO NOT USE. |
| 101 PageInfoModel(); | 100 PageInfoModel(); |
| 102 | 101 |
| 103 // Shared initialization for default and testing constructor. | 102 // Shared initialization for default and testing constructor. |
| 104 void Init(); | 103 void Init(); |
| 105 | 104 |
| 106 // Wrapper for ResourceBundle::GetNativeImage() so that Mac can retain its | |
| 107 // icons. | |
| 108 gfx::NativeImage GetBitmapNamed(int resource_id); | |
| 109 | |
| 110 PageInfoModelObserver* observer_; | 105 PageInfoModelObserver* observer_; |
| 111 | 106 |
| 112 std::vector<SectionInfo> sections_; | 107 std::vector<SectionInfo> sections_; |
| 113 | 108 |
| 114 // All possible icons that go next to the text descriptions to indicate state. | 109 // All possible icons that go next to the text descriptions to indicate state. |
| 115 std::vector<gfx::NativeImage> icons_; | 110 std::vector<gfx::Image*> icons_; |
| 116 | 111 |
| 117 // Used to request number of visits. | 112 // Used to request number of visits. |
| 118 CancelableRequestConsumer request_consumer_; | 113 CancelableRequestConsumer request_consumer_; |
| 119 | 114 |
| 120 private: | 115 private: |
| 121 DISALLOW_COPY_AND_ASSIGN(PageInfoModel); | 116 DISALLOW_COPY_AND_ASSIGN(PageInfoModel); |
| 122 }; | 117 }; |
| 123 | 118 |
| 124 #endif // CHROME_BROWSER_PAGE_INFO_MODEL_H_ | 119 #endif // CHROME_BROWSER_PAGE_INFO_MODEL_H_ |
| OLD | NEW |