2013-04-12 01:46:58 +00:00
|
|
|
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef ATOM_RENDERER_ATOM_RENDER_VIEW_OBSERVER_
|
|
|
|
#define ATOM_RENDERER_ATOM_RENDER_VIEW_OBSERVER_
|
|
|
|
|
2013-04-22 13:32:48 +00:00
|
|
|
#include "base/memory/scoped_ptr.h"
|
2013-04-12 01:46:58 +00:00
|
|
|
#include "content/public/renderer/render_view_observer.h"
|
|
|
|
|
2013-04-23 04:18:07 +00:00
|
|
|
namespace base {
|
|
|
|
class ListValue;
|
|
|
|
}
|
|
|
|
|
2013-04-12 01:46:58 +00:00
|
|
|
namespace atom {
|
|
|
|
|
2013-04-22 13:32:48 +00:00
|
|
|
class AtomRendererBindings;
|
2013-04-20 03:13:06 +00:00
|
|
|
class AtomRendererClient;
|
|
|
|
|
2013-04-12 01:46:58 +00:00
|
|
|
class AtomRenderViewObserver : content::RenderViewObserver {
|
2013-04-12 15:16:16 +00:00
|
|
|
public:
|
2013-04-20 03:13:06 +00:00
|
|
|
explicit AtomRenderViewObserver(content::RenderView* render_view,
|
|
|
|
AtomRendererClient* renderer_client);
|
2013-04-12 01:46:58 +00:00
|
|
|
|
2013-04-22 13:32:48 +00:00
|
|
|
AtomRendererBindings* atom_bindings() const { return atom_bindings_.get(); }
|
|
|
|
|
2013-04-20 06:03:55 +00:00
|
|
|
protected:
|
2013-04-12 15:16:16 +00:00
|
|
|
virtual ~AtomRenderViewObserver();
|
2013-04-12 01:46:58 +00:00
|
|
|
|
|
|
|
virtual void DidClearWindowObject(WebKit::WebFrame*) OVERRIDE;
|
2013-04-20 05:05:23 +00:00
|
|
|
virtual void FrameWillClose(WebKit::WebFrame*) OVERRIDE;
|
2013-04-12 01:46:58 +00:00
|
|
|
|
2013-04-20 06:03:55 +00:00
|
|
|
private:
|
2013-04-23 04:18:07 +00:00
|
|
|
// content::RenderViewObserver implementation.
|
|
|
|
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
|
|
|
|
|
|
|
|
void OnRendererMessage(const std::string& channel,
|
|
|
|
const base::ListValue& args);
|
|
|
|
|
2013-04-22 13:32:48 +00:00
|
|
|
scoped_ptr<AtomRendererBindings> atom_bindings_;
|
|
|
|
|
2013-04-20 03:13:06 +00:00
|
|
|
// Weak reference to renderer client.
|
|
|
|
AtomRendererClient* renderer_client_;
|
|
|
|
|
2013-04-12 01:46:58 +00:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(AtomRenderViewObserver);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace atom
|
|
|
|
|
|
|
|
#endif // ATOM_RENDERER_ATOM_RENDER_VIEW_OBSERVER_
|