OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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_frame/ready_mode/internal/ready_prompt_content.h" | 5 #include "chrome_frame/ready_mode/internal/ready_prompt_content.h" |
6 | 6 |
erikwright (departed)
2011/01/24 06:58:39
Oops. This is missing atlbase.h, atlwin.h, and Exd
robertshield
2011/01/24 16:10:21
Add them? ;-)
erikwright (departed)
2011/01/24 17:14:01
Yeah. Wanted to get this out for initial feedback
| |
7 #include <atlbase.h> | |
8 #include <atlwin.h> | |
9 | |
10 #include "base/logging.h" | 7 #include "base/logging.h" |
11 #include "chrome_frame/ready_mode/internal/ready_mode_state.h" | 8 #include "chrome_frame/ready_mode/internal/ready_mode_state.h" |
12 #include "chrome_frame/ready_mode/internal/ready_prompt_window.h" | 9 #include "chrome_frame/ready_mode/internal/ready_prompt_window.h" |
13 | 10 |
14 ReadyPromptContent::ReadyPromptContent(ReadyModeState* ready_mode_state) | 11 ReadyPromptContent::ReadyPromptContent(ReadyModeState* ready_mode_state, |
12 IWebBrowser2* web_browser) | |
15 : ready_mode_state_(ready_mode_state) { | 13 : ready_mode_state_(ready_mode_state) { |
14 web_browser->AddRef(); | |
15 web_browser_.Attach(web_browser); | |
16 } | 16 } |
17 | 17 |
18 ReadyPromptContent::~ReadyPromptContent() { | 18 ReadyPromptContent::~ReadyPromptContent() { |
19 if (window_ != NULL && window_->IsWindow()) { | 19 if (window_ != NULL && window_->IsWindow()) { |
20 // The window must discard its ContentFrame pointer at this time. | 20 // The window must discard its ContentFrame pointer at this time. |
21 window_->DestroyWindow(); | 21 window_->DestroyWindow(); |
22 window_.reset(); | 22 window_.reset(); |
23 } | 23 } |
24 } | 24 } |
25 | 25 |
26 bool ReadyPromptContent::InstallInFrame(Frame* frame) { | 26 bool ReadyPromptContent::InstallInFrame(Frame* frame) { |
27 DCHECK(window_ == NULL); | 27 DCHECK(window_ == NULL); |
28 DCHECK(ready_mode_state_ != NULL); | 28 DCHECK(ready_mode_state_ != NULL); |
29 | 29 |
30 // The window owns itself upon call to Initialize. | 30 // The window owns itself upon call to Initialize. |
31 ReadyPromptWindow* new_window_ = new ReadyPromptWindow(); | 31 ReadyPromptWindow* new_window_ = new ReadyPromptWindow(); |
robertshield
2011/01/24 16:10:21
new_window_ is not a member so shouldn't have the
| |
32 window_ = new_window_->Initialize(frame, ready_mode_state_.release()); | 32 window_ = new_window_->Initialize(frame, ready_mode_state_.release(), |
33 web_browser_); | |
33 | 34 |
34 return window_ != NULL; | 35 return window_ != NULL; |
35 } | 36 } |
36 | 37 |
37 void ReadyPromptContent::SetDimensions(const RECT& dimensions) { | 38 void ReadyPromptContent::SetDimensions(const RECT& dimensions) { |
38 if (window_ != NULL && window_->IsWindow()) { | 39 if (window_ != NULL && window_->IsWindow()) { |
39 window_->SetWindowPos(HWND_TOP, &dimensions, | 40 window_->SetWindowPos(HWND_TOP, &dimensions, |
40 ::IsRectEmpty(&dimensions) ? SWP_HIDEWINDOW : | 41 ::IsRectEmpty(&dimensions) ? SWP_HIDEWINDOW : |
41 SWP_SHOWWINDOW); | 42 SWP_SHOWWINDOW); |
42 } | 43 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
93 if (window_ == NULL || !window_->IsWindow()) { | 94 if (window_ == NULL || !window_->IsWindow()) { |
94 return 0; | 95 return 0; |
95 } | 96 } |
96 RECT dialog_dimensions = {0, 0, 0, 0}; | 97 RECT dialog_dimensions = {0, 0, 0, 0}; |
97 | 98 |
98 if (GetDialogTemplateDimensions(window_.get(), &dialog_dimensions)) | 99 if (GetDialogTemplateDimensions(window_.get(), &dialog_dimensions)) |
99 return width == 0 ? dialog_dimensions.right : dialog_dimensions.bottom; | 100 return width == 0 ? dialog_dimensions.right : dialog_dimensions.bottom; |
100 else | 101 else |
101 return width == 0 ? 0 : 39; | 102 return width == 0 ? 0 : 39; |
102 } | 103 } |
OLD | NEW |