Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Side by Side Diff: chrome/browser/views/page_info_window_view.cc

Issue 159521: Implementation of the page info dialog on Linux Gtk. (Closed)
Patch Set: Fix build Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/views/frame/browser_view.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <cryptuiapi.h> 9 #include <cryptuiapi.h>
10 #pragma comment(lib, "cryptui.lib") 10 #pragma comment(lib, "cryptui.lib")
11 #endif 11 #endif
12 12
13 #include "app/resource_bundle.h" 13 #include "app/resource_bundle.h"
14 #include "app/l10n_util.h" 14 #include "app/l10n_util.h"
15 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
16 #include "chrome/browser/cert_store.h" 16 #include "chrome/browser/cert_store.h"
17 #include "chrome/browser/page_info_model.h" 17 #include "chrome/browser/page_info_model.h"
18 #include "chrome/browser/page_info_window.h"
18 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
19 #include "grit/locale_settings.h" 20 #include "grit/locale_settings.h"
20 #include "grit/generated_resources.h" 21 #include "grit/generated_resources.h"
21 #include "net/base/x509_certificate.h" 22 #include "net/base/x509_certificate.h"
22 #include "views/background.h" 23 #include "views/background.h"
23 #include "views/grid_layout.h" 24 #include "views/grid_layout.h"
24 #include "views/controls/button/native_button.h" 25 #include "views/controls/button/native_button.h"
25 #include "views/controls/button/button.h" 26 #include "views/controls/button/button.h"
26 #include "views/controls/image_view.h" 27 #include "views/controls/image_view.h"
27 #include "views/controls/label.h" 28 #include "views/controls/label.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // views::Window overridden method. 68 // views::Window overridden method.
68 virtual void Show(); 69 virtual void Show();
69 70
70 virtual void ShowCertDialog(int cert_id); 71 virtual void ShowCertDialog(int cert_id);
71 72
72 // views::ButtonListener method. 73 // views::ButtonListener method.
73 virtual void ButtonPressed(views::Button* sender); 74 virtual void ButtonPressed(views::Button* sender);
74 75
75 // views::DialogDelegate methods: 76 // views::DialogDelegate methods:
76 virtual int GetDialogButtons() const; 77 virtual int GetDialogButtons() const;
77 virtual std::wstring GetWindowTitle() const; 78 virtual string16 GetWindowTitle() const;
78 virtual std::wstring GetWindowName() const; 79 virtual string16 GetWindowName() const;
79 virtual views::View* GetContentsView(); 80 virtual views::View* GetContentsView();
80 virtual views::View* GetExtraView(); 81 virtual views::View* GetExtraView();
81 virtual bool CanResize() const { return true; } 82 virtual bool CanResize() const { return true; }
82 83
83 // PageInfoModel::PageInfoModelObserver method. 84 // PageInfoModel::PageInfoModelObserver method.
84 virtual void ModelChanged(); 85 virtual void ModelChanged();
85 86
86 private: 87 private:
87 // This retreives the sections from the model and lay them out. 88 // This retreives the sections from the model and lay them out.
88 void LayoutSections(); 89 void LayoutSections();
(...skipping 13 matching lines...) Expand all
102 // A counter of how many page info windows are currently opened. 103 // A counter of how many page info windows are currently opened.
103 static int opened_window_count_; 104 static int opened_window_count_;
104 105
105 DISALLOW_COPY_AND_ASSIGN(PageInfoWindowView); 106 DISALLOW_COPY_AND_ASSIGN(PageInfoWindowView);
106 }; 107 };
107 108
108 // A section contains an image that shows a status (good or bad), a title, an 109 // A section contains an image that shows a status (good or bad), a title, an
109 // optional head-line (in bold) and a description. 110 // optional head-line (in bold) and a description.
110 class Section : public views::View { 111 class Section : public views::View {
111 public: 112 public:
112 Section(const std::wstring& title, 113 Section(const string16& title,
113 bool state, 114 bool state,
114 const std::wstring& head_line, 115 const string16& head_line,
115 const std::wstring& description); 116 const string16& description);
116 virtual ~Section(); 117 virtual ~Section();
117 118
118 virtual int GetHeightForWidth(int w); 119 virtual int GetHeightForWidth(int w);
119 virtual void Layout(); 120 virtual void Layout();
120 121
121 private: 122 private:
122 // The text placed on top of the section (on the left of the separator bar). 123 // The text placed on top of the section (on the left of the separator bar).
123 std::wstring title_; 124 string16 title_;
124 125
125 // Whether to show the good/bad icon. 126 // Whether to show the good/bad icon.
126 bool state_; 127 bool state_;
127 128
128 // The first line of the description, show in bold. 129 // The first line of the description, show in bold.
129 std::wstring head_line_; 130 string16 head_line_;
130 131
131 // The description, displayed below the head line. 132 // The description, displayed below the head line.
132 std::wstring description_; 133 string16 description_;
133 134
134 static SkBitmap* good_state_icon_; 135 static SkBitmap* good_state_icon_;
135 static SkBitmap* bad_state_icon_; 136 static SkBitmap* bad_state_icon_;
136 137
137 views::Label* title_label_; 138 views::Label* title_label_;
138 views::Separator* separator_; 139 views::Separator* separator_;
139 views::ImageView* status_image_; 140 views::ImageView* status_image_;
140 views::Label* head_line_label_; 141 views::Label* head_line_label_;
141 views::Label* description_label_; 142 views::Label* description_label_;
142 143
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 231
231 void PageInfoWindowView::Show() { 232 void PageInfoWindowView::Show() {
232 window()->Show(); 233 window()->Show();
233 opened_window_count_++; 234 opened_window_count_++;
234 } 235 }
235 236
236 int PageInfoWindowView::GetDialogButtons() const { 237 int PageInfoWindowView::GetDialogButtons() const {
237 return MessageBoxFlags::DIALOGBUTTON_CANCEL; 238 return MessageBoxFlags::DIALOGBUTTON_CANCEL;
238 } 239 }
239 240
240 std::wstring PageInfoWindowView::GetWindowTitle() const { 241 string16 PageInfoWindowView::GetWindowTitle() const {
241 return l10n_util::GetString(IDS_PAGEINFO_WINDOW_TITLE); 242 return l10n_util::GetString(IDS_PAGEINFO_WINDOW_TITLE);
242 } 243 }
243 244
244 std::wstring PageInfoWindowView::GetWindowName() const { 245 string16 PageInfoWindowView::GetWindowName() const {
245 return prefs::kPageInfoWindowPlacement; 246 return prefs::kPageInfoWindowPlacement;
246 } 247 }
247 248
248 views::View* PageInfoWindowView::GetContentsView() { 249 views::View* PageInfoWindowView::GetContentsView() {
249 return this; 250 return this;
250 } 251 }
251 252
252 views::View* PageInfoWindowView::GetExtraView() { 253 views::View* PageInfoWindowView::GetExtraView() {
253 if (!cert_id_) 254 if (!cert_id_)
254 return NULL; 255 return NULL;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 // modal to the browser window. 355 // modal to the browser window.
355 BOOL rv = ::CryptUIDlgViewCertificate(&view_info, &properties_changed); 356 BOOL rv = ::CryptUIDlgViewCertificate(&view_info, &properties_changed);
356 #else 357 #else
357 NOTIMPLEMENTED(); 358 NOTIMPLEMENTED();
358 #endif 359 #endif
359 } 360 }
360 361
361 //////////////////////////////////////////////////////////////////////////////// 362 ////////////////////////////////////////////////////////////////////////////////
362 // Section 363 // Section
363 364
364 Section::Section(const std::wstring& title, 365 Section::Section(const string16& title,
365 bool state, 366 bool state,
366 const std::wstring& head_line, 367 const string16& head_line,
367 const std::wstring& description) 368 const string16& description)
368 : title_(title), 369 : title_(title),
369 state_(state), 370 state_(state),
370 head_line_(head_line), 371 head_line_(head_line),
371 description_(description) { 372 description_(description) {
372 if (!good_state_icon_) { 373 if (!good_state_icon_) {
373 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 374 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
374 good_state_icon_ = rb.GetBitmapNamed(IDR_PAGEINFO_GOOD); 375 good_state_icon_ = rb.GetBitmapNamed(IDR_PAGEINFO_GOOD);
375 bad_state_icon_ = rb.GetBitmapNamed(IDR_PAGEINFO_BAD); 376 bad_state_icon_ = rb.GetBitmapNamed(IDR_PAGEINFO_BAD);
376 } 377 }
377 title_label_ = new views::Label(title); 378 title_label_ = new views::Label(title);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 Profile* profile, 473 Profile* profile,
473 const GURL& url, 474 const GURL& url,
474 const NavigationEntry::SSLStatus& ssl, 475 const NavigationEntry::SSLStatus& ssl,
475 bool show_history) { 476 bool show_history) {
476 PageInfoWindowView* page_info_window = 477 PageInfoWindowView* page_info_window =
477 new PageInfoWindowView(parent, profile, url, ssl, show_history); 478 new PageInfoWindowView(parent, profile, url, ssl, show_history);
478 page_info_window->Show(); 479 page_info_window->Show();
479 } 480 }
480 481
481 } 482 }
OLDNEW
« no previous file with comments | « chrome/browser/views/frame/browser_view.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698