| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/guest_view/mime_handler_view/mime_handler_view_gues
t.h" | 5 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_gues
t.h" |
| 6 | 6 |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "components/guest_view/common/guest_view_constants.h" | 8 #include "components/guest_view/common/guest_view_constants.h" |
| 9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
| 10 #include "content/public/browser/host_zoom_map.h" | 10 #include "content/public/browser/host_zoom_map.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 return embedder_web_contents()->GetDelegate()->OpenURLFromTab( | 162 return embedder_web_contents()->GetDelegate()->OpenURLFromTab( |
| 163 embedder_web_contents(), params); | 163 embedder_web_contents(), params); |
| 164 } | 164 } |
| 165 | 165 |
| 166 void MimeHandlerViewGuest::NavigationStateChanged( | 166 void MimeHandlerViewGuest::NavigationStateChanged( |
| 167 WebContents* source, | 167 WebContents* source, |
| 168 content::InvalidateTypes changed_flags) { | 168 content::InvalidateTypes changed_flags) { |
| 169 if (!(changed_flags & content::INVALIDATE_TYPE_TITLE)) | 169 if (!(changed_flags & content::INVALIDATE_TYPE_TITLE)) |
| 170 return; | 170 return; |
| 171 | 171 |
| 172 // Only consider title changes not triggered by URL changes. Otherwise, the |
| 173 // URL of the mime handler will be displayed. |
| 174 if (changed_flags & content::INVALIDATE_TYPE_URL) |
| 175 return; |
| 176 |
| 172 if (!is_full_page_plugin()) | 177 if (!is_full_page_plugin()) |
| 173 return; | 178 return; |
| 174 | 179 |
| 175 content::NavigationEntry* last_committed_entry = | 180 content::NavigationEntry* last_committed_entry = |
| 176 embedder_web_contents()->GetController().GetLastCommittedEntry(); | 181 embedder_web_contents()->GetController().GetLastCommittedEntry(); |
| 177 if (last_committed_entry) { | 182 if (last_committed_entry) { |
| 178 last_committed_entry->SetTitle(source->GetTitle()); | 183 last_committed_entry->SetTitle(source->GetTitle()); |
| 179 embedder_web_contents()->GetDelegate()->NavigationStateChanged( | 184 embedder_web_contents()->GetDelegate()->NavigationStateChanged( |
| 180 embedder_web_contents(), changed_flags); | 185 embedder_web_contents(), changed_flags); |
| 181 } | 186 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 element_instance_id())); | 230 element_instance_id())); |
| 226 } | 231 } |
| 227 | 232 |
| 228 base::WeakPtr<StreamContainer> MimeHandlerViewGuest::GetStream() const { | 233 base::WeakPtr<StreamContainer> MimeHandlerViewGuest::GetStream() const { |
| 229 if (!stream_) | 234 if (!stream_) |
| 230 return base::WeakPtr<StreamContainer>(); | 235 return base::WeakPtr<StreamContainer>(); |
| 231 return stream_->GetWeakPtr(); | 236 return stream_->GetWeakPtr(); |
| 232 } | 237 } |
| 233 | 238 |
| 234 } // namespace extensions | 239 } // namespace extensions |
| OLD | NEW |