Chromium Code Reviews| Index: chrome_frame/ready_mode/internal/ready_prompt_window.cc |
| =================================================================== |
| --- chrome_frame/ready_mode/internal/ready_prompt_window.cc (revision 72310) |
| +++ chrome_frame/ready_mode/internal/ready_prompt_window.cc (working copy) |
| @@ -4,23 +4,47 @@ |
| #include "chrome_frame/ready_mode/internal/ready_prompt_window.h" |
| +#include <Shellapi.h> // Must appear before atlctrlx.h |
| +#include <atlctrls.h> |
|
robertshield
2011/01/24 16:10:21
I think you want to include atlapp.h and atlwin.h
erikwright (departed)
2011/01/24 17:14:01
They are already in ready_prompt_window.h (the dec
|
| + |
| +// These seem to be required by atlctrlx? |
|
erikwright (departed)
2011/01/24 06:58:39
Anyone know why atlctrlx.h is requiring min and ma
robertshield
2011/01/24 16:10:21
Follow the above comment, and probably won't need
erikwright (departed)
2011/01/24 17:14:01
Sadly, I still get the following:
1>s:\src\chrom
|
| +template<class A> |
| +A min(A const& a, A const& b) { return a < b ? a : b; } |
| + |
| +template<class A> |
| +A max(A const& a, A const& b) { return a > b ? a : b; } |
| + |
| +#include <atlctrlx.h> |
| +#include <Exdisp.h> |
| + |
| #include "base/compiler_specific.h" |
| +#include "base/win/scoped_bstr.h" |
| +#include "base/win/scoped_comptr.h" |
| #include "chrome_frame/ready_mode/internal/ready_mode_state.h" |
| +#include "chrome_frame/simple_resource_loader.h" |
| +#include "grit/chromium_strings.h" |
| ReadyPromptWindow::ReadyPromptWindow() |
| : frame_(NULL), |
| weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
| } |
| +ReadyPromptWindow::~ReadyPromptWindow() { |
| +} |
| base::WeakPtr<ReadyPromptWindow> ReadyPromptWindow::Initialize( |
| - InfobarContent::Frame* frame, ReadyModeState* ready_mode_state) { |
| + InfobarContent::Frame* frame, ReadyModeState* ready_mode_state, |
| + IWebBrowser2* web_browser) { |
| DCHECK(frame != NULL); |
| DCHECK(frame_ == NULL); |
| DCHECK(ready_mode_state != NULL); |
| DCHECK(ready_mode_state_ == NULL); |
| + DCHECK(web_browser != NULL); |
| + DCHECK(web_browser_ == NULL); |
|
robertshield
2011/01/24 16:10:21
if Initialize can't be called twice, consider havi
erikwright (departed)
2011/01/24 17:14:01
I think this is resolved with the change to factor
|
| frame_ = frame; |
| ready_mode_state_.reset(ready_mode_state); |
| + web_browser->AddRef(); |
| + web_browser_.Attach(web_browser); |
| DCHECK(!IsWindow()); |
| @@ -30,6 +54,13 @@ |
| return base::WeakPtr<ReadyPromptWindow>(); |
| } |
| + // Subclass the "Learn more." text to make it behave like a link. Clicks are |
| + // routed to OnLearnMore(). |
| + ATL::CWindow rte = GetDlgItem(IDC_PROMPT_LINK); |
| + link_.reset(new WTL::CHyperLink()); |
| + link_->SubclassWindow(rte); |
| + link_->SetHyperLinkExtendedStyle(HLINK_NOTIFYBUTTON, HLINK_NOTIFYBUTTON); |
| + |
| return weak_ptr_factory_.GetWeakPtr(); |
| } |
| @@ -69,6 +100,20 @@ |
| return 0; |
| } |
| +LRESULT ReadyPromptWindow::OnLearnMore(WORD /*wParam*/, |
| + LPNMHDR /*lParam*/, |
| + BOOL& /*bHandled*/) { |
| + VARIANT flags = { VT_I4 }; |
| + V_I4(&flags) = navOpenInNewWindow; |
| + base::win::ScopedBstr location(SimpleResourceLoader::Get( |
| + IDS_CHROME_FRAME_READY_MODE_LEARN_MORE_URL).c_str()); |
| + |
| + HRESULT hr = web_browser_->Navigate(location, &flags, NULL, NULL, NULL); |
| + DLOG_IF(ERROR, FAILED(hr)) << "Failed to invoke Navigate on IWebBrowser2. " |
| + << "Error: " << hr; |
| + return 0; |
| +} |
| + |
| void ReadyPromptWindow::OnFinalMessage(HWND) { |
| delete this; |
| } |