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 #include "blimp/client/core/contents/navigation_feature.h" | 5 #include "blimp/client/core/contents/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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 void NavigationFeature::ProcessMessage( | 87 void NavigationFeature::ProcessMessage( |
88 std::unique_ptr<BlimpMessage> message, | 88 std::unique_ptr<BlimpMessage> message, |
89 const net::CompletionCallback& callback) { | 89 const net::CompletionCallback& callback) { |
90 DCHECK(!callback.is_null()); | 90 DCHECK(!callback.is_null()); |
91 DCHECK_EQ(BlimpMessage::kNavigation, message->feature_case()); | 91 DCHECK_EQ(BlimpMessage::kNavigation, message->feature_case()); |
92 | 92 |
93 int tab_id = message->target_tab_id(); | 93 int tab_id = message->target_tab_id(); |
94 const NavigationMessage& navigation_message = message->navigation(); | 94 const NavigationMessage& navigation_message = message->navigation(); |
95 | 95 |
96 NavigationFeatureDelegate* delegate = FindDelegate(tab_id); | 96 NavigationFeatureDelegate* delegate = FindDelegate(tab_id); |
97 DCHECK(delegate) << "NavigationFeatureDelegate not found for tab " << tab_id; | 97 if (!delegate) { |
| 98 VLOG(1) << "NavigationFeatureDelegate not found for " << tab_id |
| 99 << ". Ignoring."; |
| 100 callback.Run(net::OK); |
| 101 return; |
| 102 } |
| 103 |
98 switch (navigation_message.type()) { | 104 switch (navigation_message.type()) { |
99 case NavigationMessage::NAVIGATION_STATE_CHANGED: { | 105 case NavigationMessage::NAVIGATION_STATE_CHANGED: { |
100 const NavigationStateChangeMessage& details = | 106 const NavigationStateChangeMessage& details = |
101 navigation_message.navigation_state_changed(); | 107 navigation_message.navigation_state_changed(); |
102 if (details.has_url()) | 108 if (details.has_url()) |
103 delegate->OnUrlChanged(tab_id, GURL(details.url())); | 109 delegate->OnUrlChanged(tab_id, GURL(details.url())); |
104 | 110 |
105 if (details.has_title()) | 111 if (details.has_title()) |
106 delegate->OnTitleChanged(tab_id, details.title()); | 112 delegate->OnTitleChanged(tab_id, details.title()); |
107 | 113 |
(...skipping 25 matching lines...) Expand all Loading... |
133 const int tab_id) { | 139 const int tab_id) { |
134 base::SmallMap<std::map<int, NavigationFeatureDelegate*>>::const_iterator it = | 140 base::SmallMap<std::map<int, NavigationFeatureDelegate*>>::const_iterator it = |
135 delegates_.find(tab_id); | 141 delegates_.find(tab_id); |
136 if (it != delegates_.end()) | 142 if (it != delegates_.end()) |
137 return it->second; | 143 return it->second; |
138 return nullptr; | 144 return nullptr; |
139 } | 145 } |
140 | 146 |
141 } // namespace client | 147 } // namespace client |
142 } // namespace blimp | 148 } // namespace blimp |
OLD | NEW |