Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Unified Diff: chrome_frame/infobars/internal/subclassing_window_with_delegate.h

Issue 126143005: Remove Chrome Frame code and resources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync to r244038 Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome_frame/infobars/internal/infobar_window.cc ('k') | chrome_frame/installer_util/test.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome_frame/infobars/internal/subclassing_window_with_delegate.h
diff --git a/chrome_frame/infobars/internal/subclassing_window_with_delegate.h b/chrome_frame/infobars/internal/subclassing_window_with_delegate.h
deleted file mode 100644
index fc5f0caf872a974c7010e2450110af4630856eca..0000000000000000000000000000000000000000
--- a/chrome_frame/infobars/internal/subclassing_window_with_delegate.h
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright (c) 2011 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.
-
-#ifndef CHROME_FRAME_INFOBARS_INTERNAL_SUBCLASSING_WINDOW_WITH_DELEGATE_H_
-#define CHROME_FRAME_INFOBARS_INTERNAL_SUBCLASSING_WINDOW_WITH_DELEGATE_H_
-
-#include <atlbase.h>
-#include <atlcrack.h>
-#include <atlwin.h>
-
-#include "base/basictypes.h"
-#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
-#include "chrome_frame/pin_module.h"
-
-// Implements behavior common to HostWindowManager and DisplacedWindowManager.
-template<typename T> class SubclassingWindowWithDelegate
- : public CWindowImpl<T> {
- public:
- // Allows clients to modify the dimensions of the displaced window.
- // Through its destructor, allows clients to know when the subclassed window
- // is destroyed.
- class Delegate {
- public:
- // The delegate will be deleted when the subclassed window is destroyed.
- virtual ~Delegate() {}
-
- // Receives the natural dimensions of the displaced window. Upon return,
- // rect should contain the adjusted dimensions (i.e., possibly reduced to
- // accomodate an infobar).
- virtual void AdjustDisplacedWindowDimensions(RECT* rect) = 0;
- }; // class Delegate
-
- SubclassingWindowWithDelegate() {}
-
- // Returns true if the window is successfully subclassed, in which case this
- // instance will take responsibility for its own destruction when the window
- // is destroyed. If this method returns false, the caller should delete the
- // instance immediately.
- //
- // Takes ownership of delegate in either case, deleting it when the window
- // is destroyed (or immediately, in case of failure).
- bool Initialize(HWND hwnd, Delegate* delegate) {
- DCHECK(delegate != NULL);
- DCHECK(delegate_ == NULL);
- scoped_ptr<Delegate> new_delegate(delegate);
-
- if (!::IsWindow(hwnd) || !SubclassWindow(hwnd)) {
- PLOG(ERROR) << "Failed to subclass an HWND";
- return false;
- }
-
- // Ensure we won't be unloaded while our window proc is attached to the tab
- // window.
- chrome_frame::PinModule();
-
- delegate_.swap(new_delegate);
-
- return true;
- }
-
- // Returns the delegate associated with the specified window, if any.
- static Delegate* GetDelegateForHwnd(HWND hwnd) {
- return reinterpret_cast<Delegate*>(
- ::SendMessage(hwnd, RegisterGetDelegateMessage(), NULL, NULL));
- }
-
- BEGIN_MSG_MAP_EX(SubclassingWindowWithDelegate)
- MESSAGE_HANDLER(RegisterGetDelegateMessage(), OnGetDelegate)
- MSG_WM_DESTROY(OnDestroy)
- END_MSG_MAP()
-
- // This instance is now free to be deleted.
- virtual void OnFinalMessage(HWND hwnd) {
- delete this;
- }
-
- protected:
- scoped_ptr<Delegate>& delegate() { return delegate_; }
-
- private:
- // Registers a unique ID for our custom event.
- static UINT RegisterGetDelegateMessage() {
- static UINT message_id(
- RegisterWindowMessage(L"SubclassingWindowWithDelegate::OnGetDelegate"));
- return message_id;
- }
-
- // The subclassed window has been destroyed. Delete the delegate. We will
- // delete ourselves in OnFinalMessage.
- void OnDestroy() {
- delegate_.reset();
- }
-
- LRESULT OnGetDelegate(UINT message,
- WPARAM wparam,
- LPARAM lparam,
- BOOL& handled) {
- return reinterpret_cast<LRESULT>(delegate_.get());
- }
-
- scoped_ptr<Delegate> delegate_;
- DISALLOW_COPY_AND_ASSIGN(SubclassingWindowWithDelegate);
-}; // class SubclassingWindowWithDelegate
-
-#endif // CHROME_FRAME_INFOBARS_INTERNAL_SUBCLASSING_WINDOW_WITH_DELEGATE_H_
« no previous file with comments | « chrome_frame/infobars/internal/infobar_window.cc ('k') | chrome_frame/installer_util/test.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698