| 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 #ifndef CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_BALLOON_VIEW_HOST_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_BALLOON_VIEW_HOST_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_BALLOON_VIEW_HOST_H_ | 6 #define CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_BALLOON_VIEW_HOST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/views/notifications/balloon_view_host.h" | 9 #include "chrome/browser/views/notifications/balloon_view_host.h" |
| 10 | 10 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "gfx/native_widget_types.h" | 15 #include "gfx/native_widget_types.h" |
| 16 | 16 |
| 17 class Value; | |
| 18 class ListValue; | 17 class ListValue; |
| 19 class GURL; | 18 class GURL; |
| 20 | 19 |
| 21 namespace chromeos { | 20 namespace chromeos { |
| 22 | 21 |
| 23 typedef Callback1<const Value*>::Type MessageCallback; | 22 typedef Callback1<const ListValue*>::Type MessageCallback; |
| 24 | 23 |
| 25 class BalloonViewHost : public ::BalloonViewHost { | 24 class BalloonViewHost : public ::BalloonViewHost { |
| 26 public: | 25 public: |
| 27 explicit BalloonViewHost(Balloon* balloon) : ::BalloonViewHost(balloon) {} | 26 explicit BalloonViewHost(Balloon* balloon) : ::BalloonViewHost(balloon) {} |
| 28 virtual ~BalloonViewHost(); | 27 virtual ~BalloonViewHost(); |
| 29 | 28 |
| 30 // Adds a callback for DOMUI message. Returns true if the callback | 29 // Adds a callback for DOMUI message. Returns true if the callback |
| 31 // is succssfully registered, or false otherwise. It fails to add if | 30 // is succssfully registered, or false otherwise. It fails to add if |
| 32 // a callback for given message already exists. The callback object | 31 // a callback for given message already exists. The callback object |
| 33 // is owned and deleted by callee. | 32 // is owned and deleted by callee. |
| 34 bool AddDOMUIMessageCallback(const std::string& message, | 33 bool AddDOMUIMessageCallback(const std::string& message, |
| 35 MessageCallback* callback); | 34 MessageCallback* callback); |
| 36 | 35 |
| 37 // Process DOMUI message. | 36 // Process DOMUI message. |
| 38 void ProcessDOMUIMessage(const std::string& message, | 37 virtual void ProcessDOMUIMessage(const ViewHostMsg_DomMessage_Params& params); |
| 39 const ListValue* content, | |
| 40 const GURL& source_url, | |
| 41 int request_id, | |
| 42 bool has_callback); | |
| 43 | 38 |
| 44 private: | 39 private: |
| 45 // A map of message name -> message handling callback. | 40 // A map of message name -> message handling callback. |
| 46 typedef std::map<std::string, MessageCallback*> MessageCallbackMap; | 41 typedef std::map<std::string, MessageCallback*> MessageCallbackMap; |
| 47 MessageCallbackMap message_callbacks_; | 42 MessageCallbackMap message_callbacks_; |
| 48 | 43 |
| 49 DISALLOW_COPY_AND_ASSIGN(BalloonViewHost); | 44 DISALLOW_COPY_AND_ASSIGN(BalloonViewHost); |
| 50 }; | 45 }; |
| 51 | 46 |
| 52 } // namespace chromeos | 47 } // namespace chromeos |
| 53 | 48 |
| 54 #endif // CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_BALLOON_VIEW_HOST_H_ | 49 #endif // CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_BALLOON_VIEW_HOST_H_ |
| OLD | NEW |