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

Side by Side Diff: blimp/client/feature/navigation_feature.cc

Issue 1933053003: Used oneof in blimp_message.proto (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
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 #include "blimp/client/feature/navigation_feature.h" 5 #include "blimp/client/feature/navigation_feature.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "blimp/common/create_blimp_message.h" 10 #include "blimp/common/create_blimp_message.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 navigation_message->set_type(NavigationMessage::GO_BACK); 95 navigation_message->set_type(NavigationMessage::GO_BACK);
96 96
97 outgoing_message_processor_->ProcessMessage(std::move(blimp_message), 97 outgoing_message_processor_->ProcessMessage(std::move(blimp_message),
98 net::CompletionCallback()); 98 net::CompletionCallback());
99 } 99 }
100 100
101 void NavigationFeature::ProcessMessage( 101 void NavigationFeature::ProcessMessage(
102 std::unique_ptr<BlimpMessage> message, 102 std::unique_ptr<BlimpMessage> message,
103 const net::CompletionCallback& callback) { 103 const net::CompletionCallback& callback) {
104 DCHECK(!callback.is_null()); 104 DCHECK(!callback.is_null());
105 DCHECK(message->type() == BlimpMessage::NAVIGATION); 105 DCHECK(message->has_navigation());
Kevin M 2016/05/02 17:47:47 Check case
shaktisahu 2016/05/16 20:19:02 Done.
106 106
107 int tab_id = message->target_tab_id(); 107 int tab_id = message->target_tab_id();
108 DCHECK(message->has_navigation());
109 const NavigationMessage& navigation_message = message->navigation(); 108 const NavigationMessage& navigation_message = message->navigation();
110 109
111 NavigationFeatureDelegate* delegate = FindDelegate(tab_id); 110 NavigationFeatureDelegate* delegate = FindDelegate(tab_id);
112 DCHECK(delegate) << "NavigationFeatureDelegate not found for tab " << tab_id; 111 DCHECK(delegate) << "NavigationFeatureDelegate not found for tab " << tab_id;
113 switch (navigation_message.type()) { 112 switch (navigation_message.type()) {
114 case NavigationMessage::NAVIGATION_STATE_CHANGED: { 113 case NavigationMessage::NAVIGATION_STATE_CHANGED: {
115 const NavigationStateChangeMessage& details = 114 const NavigationStateChangeMessage& details =
116 navigation_message.navigation_state_changed(); 115 navigation_message.navigation_state_changed();
117 if (details.has_url()) 116 if (details.has_url())
118 delegate->OnUrlChanged(tab_id, GURL(details.url())); 117 delegate->OnUrlChanged(tab_id, GURL(details.url()));
(...skipping 29 matching lines...) Expand all
148 NavigationFeature::NavigationFeatureDelegate* NavigationFeature::FindDelegate( 147 NavigationFeature::NavigationFeatureDelegate* NavigationFeature::FindDelegate(
149 const int tab_id) { 148 const int tab_id) {
150 DelegateMap::const_iterator it = delegates_.find(tab_id); 149 DelegateMap::const_iterator it = delegates_.find(tab_id);
151 if (it != delegates_.end()) 150 if (it != delegates_.end())
152 return it->second; 151 return it->second;
153 return nullptr; 152 return nullptr;
154 } 153 }
155 154
156 } // namespace client 155 } // namespace client
157 } // namespace blimp 156 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698