From d7483fd119690067a7f31df60b612e1606567d0b Mon Sep 17 00:00:00 2001 From: "sky@google.com" Date: Wed, 28 Jan 2009 00:15:54 +0000 Subject: Adds the ability to have browser windows shown with a specific state. I need this for in process ui tests. I can move this to be private and make the test a friend if you prefer. BUG=none TEST=none Review URL: http://codereview.chromium.org/19404 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8773 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/views/frame/browser_view.cc | 11 +++++++++++ chrome/browser/views/frame/browser_view.h | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index 1e5ad23..0d20e835e 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -84,6 +84,9 @@ static const int kDefaultPluginMessageResponseTimeout = 30000; // The number of milliseconds between loading animation frames. static const int kLoadingAnimationFrameTimeMs = 30; +// If not -1, windows are shown with this state. +static int explicit_show_state = -1; + static const struct { bool separator; int command; int label; } kMenuLayout[] = { { true, 0, 0 }, { false, IDC_TASK_MANAGER, IDS_TASK_MANAGER }, @@ -111,6 +114,11 @@ static const struct { bool separator; int command; int label; } kMenuLayout[] = /////////////////////////////////////////////////////////////////////////////// // BrowserView, public: +// static +void BrowserView::SetShowState(int state) { + explicit_show_state = state; +} + BrowserView::BrowserView(Browser* browser) : ClientView(NULL, NULL), frame_(NULL), @@ -154,6 +162,9 @@ BrowserView* BrowserView::GetBrowserViewForHWND(HWND window) { } int BrowserView::GetShowState() const { + if (explicit_show_state != -1) + return explicit_show_state; + STARTUPINFO si = {0}; si.cb = sizeof(si); si.dwFlags = STARTF_USESHOWWINDOW; diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h index 1a6ff36..0b5768f 100644 --- a/chrome/browser/views/frame/browser_view.h +++ b/chrome/browser/views/frame/browser_view.h @@ -44,6 +44,11 @@ class BrowserView : public BrowserWindow, // frame border. static const int kClientEdgeThickness; + // Explicitly sets how windows are shown. Use a value of -1 to give the + // default behavior. This is used during testing and not generally useful + // otherwise. + static void SetShowState(int state); + explicit BrowserView(Browser* browser); virtual ~BrowserView(); -- cgit v1.1