Chromium Code Reviews| Index: ceee/ie/plugin/toolband/tool_band.cc |
| =================================================================== |
| --- ceee/ie/plugin/toolband/tool_band.cc (revision 71215) |
| +++ ceee/ie/plugin/toolband/tool_band.cc (working copy) |
| @@ -304,7 +304,14 @@ |
| if (!parent_window_) |
| return E_FAIL; |
| - if (NULL == Create(parent_window_)) |
| + // WS_CHILD | WS_VISIBLE | TBSTYLE_TRANSPARENT | CCS_NODIVIDER are critical |
| + // for painting toolband background while chrome frame is hidden. |
|
Sigurður Ásgeirsson
2011/01/13 14:42:55
nice, thanks. Do you prefer this to specifying a s
Vitaly Buka (NO REVIEWS)
2011/01/14 00:06:30
Done.
|
| + // Rest was copied from IE favorite bar. |
| + DWORD style = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; |
| + style += TBSTYLE_TOOLTIPS | TBSTYLE_TRANSPARENT | TBSTYLE_LIST | TBSTYLE_FLAT; |
| + style += CCS_NODIVIDER | CCS_NOPARENTALIGN | CCS_NORESIZE | CCS_TOP; |
| + |
| + if (NULL == Create(parent_window_, NULL, NULL, style)) |
| return E_FAIL; |
| BOOL shown = ShowWindow(SW_SHOW); |
| @@ -330,7 +337,6 @@ |
| if (chrome_frame_) { |
| ChromeFrameEvents::DispEventUnadvise(chrome_frame_); |
| } |
| - chrome_frame_window_ = NULL; |
| if (web_browser_ && listening_to_browser_events_) { |
| HostingBrowserEvents::DispEventUnadvise(web_browser_, |
| @@ -349,6 +355,8 @@ |
| // Grab a self-reference. |
| GetUnknown()->AddRef(); |
| + chrome_frame_container_window_.Create(m_hWnd, NULL, NULL, WS_CHILD); |
|
Sigurður Ásgeirsson
2011/01/13 14:42:55
Please retrieve the result and error check it.
Vitaly Buka (NO REVIEWS)
2011/01/14 00:06:30
Done.
|
| + |
| // Create a host window instance. |
| base::win::ScopedComPtr<IAxWinHostWindow> host; |
| HRESULT hr = CAxHostWindow::CreateInstance(host.Receive()); |
| @@ -372,23 +380,14 @@ |
| } |
| // And attach it to our window. |
| - hr = host->AttachControl(chrome_frame_, m_hWnd); |
| + hr = host->AttachControl(chrome_frame_, |
| + chrome_frame_container_window_.m_hWnd); |
| if (FAILED(hr)) { |
| LOG(ERROR) << "Failed to attach Chrome Frame to the host. " << |
| com::LogHr(hr); |
| return 1; |
| } |
| - // Get the GCF window and hide it for now. |
| - CComQIPtr<IOleWindow> ole_window(chrome_frame_); |
| - DCHECK(ole_window != NULL); |
| - if (SUCCEEDED(ole_window->GetWindow(&chrome_frame_window_.m_hWnd))) { |
| - // We hide the chrome frame window until onload in order to avoid |
| - // seeing the "Aw Snap" that sometimes otherwise occurs during Chrome |
| - // initialization. |
| - chrome_frame_window_.ShowWindow(SW_HIDE); |
| - } |
| - |
| // Hook up the chrome frame event listener. |
| hr = ChromeFrameEvents::DispEventAdvise(chrome_frame_); |
| if (FAILED(hr)) { |
| @@ -398,23 +397,6 @@ |
| return 0; |
| } |
| -void ToolBand::OnPaint(CDCHandle dc) { |
| - RECT rc = {}; |
| - if (GetUpdateRect(&rc, FALSE)) { |
| - PAINTSTRUCT ps = {}; |
| - BeginPaint(&ps); |
| - |
| - BOOL ret = GetClientRect(&rc); |
| - DCHECK(ret); |
| - CString text; |
| - text.Format(L"Google CEEE. No Chrome Frame found. Instance: 0x%p. ID: %d!)", |
| - this, band_id_); |
| - ::DrawText(ps.hdc, text, -1, &rc, DT_SINGLELINE | DT_BOTTOM | DT_CENTER); |
| - |
| - EndPaint(&ps); |
| - } |
| -} |
| - |
| void ToolBand::OnSize(UINT type, CSize size) { |
| LOG(INFO) << "ToolBand::OnSize(" << type << ", " |
| << size.cx << "x" << size.cy << ")"; |
| @@ -584,9 +566,9 @@ |
| } |
| STDMETHODIMP_(void) ToolBand::OnCfOnload(IDispatch* event) { |
| - if (chrome_frame_window_.IsWindow()) { |
| + if (chrome_frame_container_window_.IsWindow()) { |
| VLOG(1) << "Showing the Chrome Frame window."; |
| - chrome_frame_window_.ShowWindow(SW_SHOW); |
| + chrome_frame_container_window_.ShowWindow(SW_SHOW); |
| } |
| } |