|
OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome_frame/ready_mode/internal/ready_prompt_content.h" | |
6 | |
7 #include "base/logging.h" | |
8 #include "chrome_frame/ready_mode/internal/ready_mode_state.h" | |
9 #include "chrome_frame/ready_mode/internal/ready_prompt_window.h" | |
10 | |
11 ReadyPromptContent::ReadyPromptContent(ReadyModeState* ready_mode_state) | |
12 : ready_mode_state_(ready_mode_state) { | |
13 } | |
14 | |
15 ReadyPromptContent::~ReadyPromptContent() { | |
16 if (window_ != NULL && window_->IsWindow()) { | |
17 // The window must discard its ContentFrame pointer at this time. | |
18 window_->DestroyWindow(); | |
amit
2010/12/09 22:41:33
nit: window_ == NULL?
erikwright (departed)
2010/12/10 20:29:58
Done.
| |
19 } | |
20 } | |
21 | |
22 bool ReadyPromptContent::InstallInFrame(Frame* frame) { | |
23 DCHECK(window_ == NULL); | |
24 DCHECK(ready_mode_state_ != NULL); | |
25 | |
26 // The window owns itself upon call to Initialize. | |
27 ReadyPromptWindow* new_window_ = new ReadyPromptWindow(); | |
28 window_ = new_window_->Initialize(frame, ready_mode_state_.release()); | |
29 | |
30 return window_ != NULL; | |
31 } | |
32 | |
33 void ReadyPromptContent::SetDimensions(const RECT& dimensions) { | |
34 if (window_ != NULL && window_->IsWindow()) { | |
35 window_->SetWindowPos(HWND_TOP, | |
36 &dimensions, | |
37 dimensions.bottom == dimensions.top || | |
38 dimensions.left == dimensions.right ? | |
amit
2010/12/09 22:41:33
IsRectEmpty(&dimentions) ?
erikwright (departed)
2010/12/10 20:29:58
Done.
| |
39 SWP_HIDEWINDOW : SWP_SHOWWINDOW); | |
40 } | |
41 } | |
42 | |
43 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
| |
44 if (width == 0) // Don't handle a left- or right-side infobar | |
45 return 0; | |
46 else | |
47 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.
| |
48 } | |
OLD | NEW |