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

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

Issue 10218: Looks like a size method got left behind in the gfx update. Also make sure th... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/views/options/options_window_view.cc ('k') | no next file » | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/views/page_info_window.h" 5 #include "chrome/browser/views/page_info_window.h"
6 6
7 #include <cryptuiapi.h> 7 #include <cryptuiapi.h>
8 #pragma comment(lib, "cryptui.lib") 8 #pragma comment(lib, "cryptui.lib")
9 9
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 // PageInfoContentView 434 // PageInfoContentView
435 class PageInfoContentView : public views::View { 435 class PageInfoContentView : public views::View {
436 public: 436 public:
437 PageInfoContentView() : cert_viewer_button_(NULL) {} 437 PageInfoContentView() : cert_viewer_button_(NULL) {}
438 438
439 void set_cert_viewer_button(views::NativeButton* cert_viewer_button) { 439 void set_cert_viewer_button(views::NativeButton* cert_viewer_button) {
440 cert_viewer_button_ = cert_viewer_button; 440 cert_viewer_button_ = cert_viewer_button;
441 } 441 }
442 442
443 // views::View overrides: 443 // views::View overrides:
444 virtual void GetPreferredSize(CSize *out) { 444 virtual gfx::Size GetPreferredSize() {
445 DCHECK(out); 445 return gfx::Size(views::Window::GetLocalizedContentsSize(
446 *out = views::Window::GetLocalizedContentsSize(
447 IDS_PAGEINFO_DIALOG_WIDTH_CHARS, 446 IDS_PAGEINFO_DIALOG_WIDTH_CHARS,
448 IDS_PAGEINFO_DIALOG_HEIGHT_LINES).ToSIZE(); 447 IDS_PAGEINFO_DIALOG_HEIGHT_LINES));
449 } 448 }
450 449
451 virtual void Layout() { 450 virtual void Layout() {
452 if (cert_viewer_button_) { 451 if (cert_viewer_button_) {
453 gfx::Size ps = cert_viewer_button_->GetPreferredSize(); 452 gfx::Size ps = cert_viewer_button_->GetPreferredSize();
454 453
455 gfx::Rect parent_bounds = GetParent()->GetLocalBounds(false); 454 gfx::Rect parent_bounds = GetParent()->GetLocalBounds(false);
456 int y_buttons = 455 int y_buttons =
457 parent_bounds.bottom() - ps.height() - kButtonVEdgeMargin; 456 parent_bounds.bottom() - ps.height() - kButtonVEdgeMargin;
458 cert_viewer_button_->SetBounds(kPanelHorizMargin, y_buttons, ps.width(), 457 cert_viewer_button_->SetBounds(kPanelHorizMargin, y_buttons, ps.width(),
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 bool maximized, 608 bool maximized,
610 bool always_on_top) { 609 bool always_on_top) {
611 window()->SaveWindowPositionToPrefService(g_browser_process->local_state(), 610 window()->SaveWindowPositionToPrefService(g_browser_process->local_state(),
612 prefs::kPageInfoWindowPlacement, 611 prefs::kPageInfoWindowPlacement,
613 bounds, maximized, always_on_top); 612 bounds, maximized, always_on_top);
614 } 613 }
615 614
616 bool PageInfoWindow::RestoreWindowPosition(CRect* bounds, 615 bool PageInfoWindow::RestoreWindowPosition(CRect* bounds,
617 bool* maximized, 616 bool* maximized,
618 bool* always_on_top) { 617 bool* always_on_top) {
619 return window()->RestoreWindowPositionFromPrefService( 618 bool restore = window()->RestoreWindowPositionFromPrefService(
620 g_browser_process->local_state(), 619 g_browser_process->local_state(),
621 prefs::kPageInfoWindowPlacement, 620 prefs::kPageInfoWindowPlacement,
622 bounds, maximized, always_on_top); 621 bounds, maximized, always_on_top);
622
623 if (restore) {
624 // Force the correct width and height in case we've changed it
625 // or the pref got messed up (we know that some users will have
626 // the wrong preference if they ran into bug 3509). This isn't
627 // a resizable dialog, so overriding the saved width and height
628 // shouldn't be noticable.
629 gfx::Size size = contents_->GetPreferredSize();
630 bounds->right = bounds->left + size.width();
631 bounds->bottom = bounds->top + size.height();
632 }
633
634 return restore;
623 } 635 }
624 636
625 views::View* PageInfoWindow::GetContentsView() { 637 views::View* PageInfoWindow::GetContentsView() {
626 return contents_; 638 return contents_;
627 } 639 }
628 640
629 void PageInfoWindow::ButtonPressed(views::NativeButton* sender) { 641 void PageInfoWindow::ButtonPressed(views::NativeButton* sender) {
630 if (sender == cert_info_button_) { 642 if (sender == cert_info_button_) {
631 DCHECK(cert_id_ != 0); 643 DCHECK(cert_id_ != 0);
632 ShowCertDialog(cert_id_); 644 ShowCertDialog(cert_id_);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 HCERTSTORE cert_store = view_info.pCertContext->hCertStore; 703 HCERTSTORE cert_store = view_info.pCertContext->hCertStore;
692 view_info.cStores = 1; 704 view_info.cStores = 1;
693 view_info.rghStores = &cert_store; 705 view_info.rghStores = &cert_store;
694 BOOL properties_changed; 706 BOOL properties_changed;
695 707
696 // This next call blocks but keeps processing windows messages, making it 708 // This next call blocks but keeps processing windows messages, making it
697 // modal to the browser window. 709 // modal to the browser window.
698 BOOL rv = ::CryptUIDlgViewCertificate(&view_info, &properties_changed); 710 BOOL rv = ::CryptUIDlgViewCertificate(&view_info, &properties_changed);
699 } 711 }
700 712
OLDNEW
« no previous file with comments | « chrome/browser/views/options/options_window_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698