diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-21 21:26:13 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-21 21:26:13 +0000 |
commit | 8ebd02bc2e0b778418c06060d990fc6ceda21b5a (patch) | |
tree | 653dba7a527bb1ef22ce401eef8788f2ac35d844 /chrome/browser/views/page_info_window.cc | |
parent | 0a9fe25653daa90f09eb7ff5b8309ccc70c20537 (diff) | |
download | chromium_src-8ebd02bc2e0b778418c06060d990fc6ceda21b5a.zip chromium_src-8ebd02bc2e0b778418c06060d990fc6ceda21b5a.tar.gz chromium_src-8ebd02bc2e0b778418c06060d990fc6ceda21b5a.tar.bz2 |
Gets LocationBarView to compile on linux. PageInfoWindow is nearly
there too, but needs Separator to actually completely compile.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/113720
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16660 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/page_info_window.cc')
-rw-r--r-- | chrome/browser/views/page_info_window.cc | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/chrome/browser/views/page_info_window.cc b/chrome/browser/views/page_info_window.cc index c92325b..d05aabb 100644 --- a/chrome/browser/views/page_info_window.cc +++ b/chrome/browser/views/page_info_window.cc @@ -4,16 +4,13 @@ #include "chrome/browser/views/page_info_window.h" +#if defined(OS_WIN) #include <cryptuiapi.h> #pragma comment(lib, "cryptui.lib") - -#include <atlbase.h> -#include <atlapp.h> -#include <atlmisc.h> +#endif #include "app/l10n_util.h" #include "app/resource_bundle.h" -#include "app/win_util.h" #include "base/string_util.h" #include "base/time_format.h" #include "chrome/browser/browser_process.h" @@ -37,6 +34,10 @@ #include "views/controls/separator.h" #include "views/standard_layout.h" +#if defined(OS_WIN) +#include "app/win_util.h" +#endif + using base::Time; const int kVerticalPadding = 10; @@ -560,9 +561,8 @@ void PageInfoWindow::Init(Profile* profile, gfx::Rect bounds; bool maximized = false; if (GetSavedWindowBounds(&bounds) && GetSavedMaximizedState(&maximized)) { - CRect bounds_crect(bounds.ToRECT()); - CalculateWindowBounds(&bounds_crect); - SaveWindowPlacement(gfx::Rect(bounds_crect), maximized); + CalculateWindowBounds(&bounds); + SaveWindowPlacement(bounds, maximized); } } @@ -625,42 +625,49 @@ void PageInfoWindow::ButtonPressed(views::Button* sender) { } } -void PageInfoWindow::CalculateWindowBounds(CRect* bounds) { +void PageInfoWindow::CalculateWindowBounds(gfx::Rect* bounds) { const int kDefaultOffset = 15; - gfx::Rect window_bounds(*bounds); - gfx::Rect monitor_bounds(win_util::GetMonitorBoundsForRect(window_bounds)); +#if defined(OS_WIN) + gfx::Rect monitor_bounds(win_util::GetMonitorBoundsForRect(*bounds)); +#else + gfx::Rect monitor_bounds; + NOTIMPLEMENTED(); +#endif + + if (monitor_bounds.IsEmpty()) + return; // If necessary, move the window so it is visible on the screen. - gfx::Rect adjusted_bounds = window_bounds.AdjustToFit(monitor_bounds); - if (adjusted_bounds != window_bounds) { + gfx::Rect adjusted_bounds = bounds->AdjustToFit(monitor_bounds); + if (adjusted_bounds != *bounds) { // The bounds have moved, we are done. - RECT rect = adjusted_bounds.ToRECT(); - bounds->CopyRect(&rect); + *bounds = adjusted_bounds; return; } // Move the window from its specified position, trying to keep it entirely // visible. int x_offset, y_offset; - if (window_bounds.right() + kDefaultOffset >= monitor_bounds.right() && - abs(monitor_bounds.x() - window_bounds.x()) >= kDefaultOffset) { + if (bounds->right() + kDefaultOffset >= monitor_bounds.right() && + abs(monitor_bounds.x() - bounds->x()) >= kDefaultOffset) { x_offset = -kDefaultOffset; } else { x_offset = kDefaultOffset; } - if (window_bounds.bottom() + kDefaultOffset >= monitor_bounds.bottom() && - abs(monitor_bounds.y() - window_bounds.y()) >= kDefaultOffset) { + if (bounds->bottom() + kDefaultOffset >= monitor_bounds.bottom() && + abs(monitor_bounds.y() - bounds->y()) >= kDefaultOffset) { y_offset = -kDefaultOffset; } else { y_offset = kDefaultOffset; } - bounds->OffsetRect(x_offset, y_offset); + bounds->Offset(x_offset, y_offset); } void PageInfoWindow::ShowCertDialog(int cert_id) { +#if defined(OS_WIN) scoped_refptr<net::X509Certificate> cert; CertStore::GetSharedInstance()->RetrieveCert(cert_id, &cert); if (!cert.get()) { @@ -686,4 +693,5 @@ void PageInfoWindow::ShowCertDialog(int cert_id) { // This next call blocks but keeps processing windows messages, making it // modal to the browser window. BOOL rv = ::CryptUIDlgViewCertificate(&view_info, &properties_changed); +#endif } |