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

Side by Side Diff: blimp/client/session/navigation_feature.h

Issue 1636163002: Restructure contents of blimp/client. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef BLIMP_CLIENT_SESSION_NAVIGATION_FEATURE_H_
6 #define BLIMP_CLIENT_SESSION_NAVIGATION_FEATURE_H_
7
8 #include "base/containers/small_map.h"
9 #include "base/macros.h"
10 #include "blimp/client/blimp_client_export.h"
11 #include "blimp/net/blimp_message_processor.h"
12
13 class GURL;
14 class SkBitmap;
15
16 namespace blimp {
17 namespace client {
18
19 // Handles all incoming and outgoing protobuf messages of type
20 // RenderWidget::NAVIGATION. Delegates can be added to be notified of incoming
21 // messages.
22 class BLIMP_CLIENT_EXPORT NavigationFeature : public BlimpMessageProcessor {
23 public:
24 // A delegate to be notified of specific navigation events related to a
25 // a particular tab.
26 class NavigationFeatureDelegate {
27 public:
28 virtual void OnUrlChanged(int tab_id, const GURL& url) = 0;
29 virtual void OnFaviconChanged(int tab_id, const SkBitmap& favicon) = 0;
30 virtual void OnTitleChanged(int tab_id, const std::string& title) = 0;
31 virtual void OnLoadingChanged(int tab_id, bool loading) = 0;
32 };
33
34 NavigationFeature();
35 ~NavigationFeature() override;
36
37 // Set the BlimpMessageProcessor that will be used to send
38 // BlimpMessage::NAVIGATION messages to the engine.
39 void set_outgoing_message_processor(
40 scoped_ptr<BlimpMessageProcessor> processor);
41
42 // Sets a NavigationMessageDelegate to be notified of all navigation messages
43 // for |tab_id| from the engine.
44 void SetDelegate(int tab_id, NavigationFeatureDelegate* delegate);
45 void RemoveDelegate(int tab_id);
46
47 void NavigateToUrlText(int tab_id, const std::string& url_text);
48 void Reload(int tab_id);
49 void GoForward(int tab_id);
50 void GoBack(int tab_id);
51
52 private:
53 // BlimpMessageProcessor implementation.
54 void ProcessMessage(scoped_ptr<BlimpMessage> message,
55 const net::CompletionCallback& callback) override;
56
57 NavigationFeatureDelegate* FindDelegate(const int tab_id);
58
59 typedef base::SmallMap<std::map<int, NavigationFeatureDelegate*>> DelegateMap;
60
61 DelegateMap delegates_;
62
63 // Used to send BlimpMessage::NAVIGATION messages to the engine.
64 scoped_ptr<BlimpMessageProcessor> outgoing_message_processor_;
65
66 DISALLOW_COPY_AND_ASSIGN(NavigationFeature);
67 };
68
69 } // namespace client
70 } // namespace blimp
71
72 #endif // BLIMP_CLIENT_SESSION_NAVIGATION_FEATURE_H_
OLDNEW
« no previous file with comments | « blimp/client/session/blimp_client_session_linux.cc ('k') | blimp/client/session/navigation_feature.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698