Chromium Code Reviews| Index: chrome_frame/ready_mode/internal/ready_prompt_content.cc |
| =================================================================== |
| --- chrome_frame/ready_mode/internal/ready_prompt_content.cc (revision 0) |
| +++ chrome_frame/ready_mode/internal/ready_prompt_content.cc (revision 0) |
| @@ -0,0 +1,48 @@ |
| +// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome_frame/ready_mode/internal/ready_prompt_content.h" |
| + |
| +#include "base/logging.h" |
| +#include "chrome_frame/ready_mode/internal/ready_mode_state.h" |
| +#include "chrome_frame/ready_mode/internal/ready_prompt_window.h" |
| + |
| +ReadyPromptContent::ReadyPromptContent(ReadyModeState* ready_mode_state) |
| + : ready_mode_state_(ready_mode_state) { |
| +} |
| + |
| +ReadyPromptContent::~ReadyPromptContent() { |
| + if (window_ != NULL && window_->IsWindow()) { |
| + // The window must discard its ContentFrame pointer at this time. |
| + window_->DestroyWindow(); |
|
amit
2010/12/09 22:41:33
nit: window_ == NULL?
erikwright (departed)
2010/12/10 20:29:58
Done.
|
| + } |
| +} |
| + |
| +bool ReadyPromptContent::InstallInFrame(Frame* frame) { |
| + DCHECK(window_ == NULL); |
| + DCHECK(ready_mode_state_ != NULL); |
| + |
| + // The window owns itself upon call to Initialize. |
| + ReadyPromptWindow* new_window_ = new ReadyPromptWindow(); |
| + window_ = new_window_->Initialize(frame, ready_mode_state_.release()); |
| + |
| + return window_ != NULL; |
| +} |
| + |
| +void ReadyPromptContent::SetDimensions(const RECT& dimensions) { |
| + if (window_ != NULL && window_->IsWindow()) { |
| + window_->SetWindowPos(HWND_TOP, |
| + &dimensions, |
| + dimensions.bottom == dimensions.top || |
| + dimensions.left == dimensions.right ? |
|
amit
2010/12/09 22:41:33
IsRectEmpty(&dimentions) ?
erikwright (departed)
2010/12/10 20:29:58
Done.
|
| + SWP_HIDEWINDOW : SWP_SHOWWINDOW); |
| + } |
| +} |
| + |
| +size_t ReadyPromptContent::GetDesiredSize(size_t width, size_t height) { |
|
amit
2010/12/09 22:41:33
nit: GetDesiredHeight?
erikwright (departed)
2010/12/10 20:29:58
It's part of the infobar API, which could be used
|
| + if (width == 0) // Don't handle a left- or right-side infobar |
| + return 0; |
| + else |
| + return 39; // TODO(erikwright): Get the dialog template's natural height |
|
amit
2010/12/09 22:41:33
will this be addressed before check in?
erikwright (departed)
2010/12/10 02:41:33
Ideally. Do you know how, off the top of your head
erikwright (departed)
2010/12/10 20:29:58
Done.
|
| +} |
| Property changes on: chrome_frame\ready_mode\internal\ready_prompt_content.cc |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| + LF |