Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 BLIMP_CLIENT_FEATURE_NAVIGATION_FEATURE_H_ | 5 #ifndef BLIMP_CLIENT_FEATURE_NAVIGATION_FEATURE_H_ |
|
nyquist
2016/07/25 22:59:06
Can this be moved to //blimp/client/core/contents?
| |
| 6 #define BLIMP_CLIENT_FEATURE_NAVIGATION_FEATURE_H_ | 6 #define BLIMP_CLIENT_FEATURE_NAVIGATION_FEATURE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/containers/small_map.h" | 11 #include "base/containers/small_map.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "blimp/net/blimp_message_processor.h" | 13 #include "blimp/net/blimp_message_processor.h" |
| 14 | 14 |
| 15 class GURL; | 15 class GURL; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 41 // Set the BlimpMessageProcessor that will be used to send | 41 // Set the BlimpMessageProcessor that will be used to send |
| 42 // BlimpMessage::NAVIGATION messages to the engine. | 42 // BlimpMessage::NAVIGATION messages to the engine. |
| 43 void set_outgoing_message_processor( | 43 void set_outgoing_message_processor( |
| 44 std::unique_ptr<BlimpMessageProcessor> processor); | 44 std::unique_ptr<BlimpMessageProcessor> processor); |
| 45 | 45 |
| 46 // Sets a NavigationMessageDelegate to be notified of all navigation messages | 46 // Sets a NavigationMessageDelegate to be notified of all navigation messages |
| 47 // for |tab_id| from the engine. | 47 // for |tab_id| from the engine. |
| 48 void SetDelegate(int tab_id, NavigationFeatureDelegate* delegate); | 48 void SetDelegate(int tab_id, NavigationFeatureDelegate* delegate); |
| 49 void RemoveDelegate(int tab_id); | 49 void RemoveDelegate(int tab_id); |
| 50 | 50 |
| 51 void NavigateToUrlText(int tab_id, const std::string& url_text); | 51 // virtual for testing. |
|
David Trainor- moved to gerrit
2016/07/25 15:57:32
Do we want to test this to/from the proto level li
shaktisahu
2016/07/26 01:25:27
I wanted to test that the feature is getting calle
| |
| 52 void Reload(int tab_id); | 52 virtual void NavigateToUrlText(int tab_id, const std::string& url_text); |
| 53 void GoForward(int tab_id); | 53 virtual void Reload(int tab_id); |
| 54 void GoBack(int tab_id); | 54 virtual void GoForward(int tab_id); |
| 55 virtual void GoBack(int tab_id); | |
| 55 | 56 |
| 56 // BlimpMessageProcessor implementation. | 57 // BlimpMessageProcessor implementation. |
| 57 void ProcessMessage(std::unique_ptr<BlimpMessage> message, | 58 void ProcessMessage(std::unique_ptr<BlimpMessage> message, |
| 58 const net::CompletionCallback& callback) override; | 59 const net::CompletionCallback& callback) override; |
| 59 | 60 |
| 60 private: | 61 protected: |
| 62 // Finds the NavigationFeatureDelegate for a |tab_id|, protected for unit | |
| 63 // tests. | |
| 61 NavigationFeatureDelegate* FindDelegate(const int tab_id); | 64 NavigationFeatureDelegate* FindDelegate(const int tab_id); |
| 62 | 65 |
| 66 private: | |
| 63 typedef base::SmallMap<std::map<int, NavigationFeatureDelegate*>> DelegateMap; | 67 typedef base::SmallMap<std::map<int, NavigationFeatureDelegate*>> DelegateMap; |
| 64 | 68 |
| 65 DelegateMap delegates_; | 69 DelegateMap delegates_; |
| 66 | 70 |
| 67 // Used to send BlimpMessage::NAVIGATION messages to the engine. | 71 // Used to send BlimpMessage::NAVIGATION messages to the engine. |
| 68 std::unique_ptr<BlimpMessageProcessor> outgoing_message_processor_; | 72 std::unique_ptr<BlimpMessageProcessor> outgoing_message_processor_; |
| 69 | 73 |
| 70 DISALLOW_COPY_AND_ASSIGN(NavigationFeature); | 74 DISALLOW_COPY_AND_ASSIGN(NavigationFeature); |
| 71 }; | 75 }; |
| 72 | 76 |
| 73 } // namespace client | 77 } // namespace client |
| 74 } // namespace blimp | 78 } // namespace blimp |
| 75 | 79 |
| 76 #endif // BLIMP_CLIENT_FEATURE_NAVIGATION_FEATURE_H_ | 80 #endif // BLIMP_CLIENT_FEATURE_NAVIGATION_FEATURE_H_ |
| OLD | NEW |