OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/tab_contents/tab_contents.h" | 5 #include "chrome/browser/tab_contents/tab_contents.h" |
6 | 6 |
7 #if defined(OS_CHROMEOS) | 7 #if defined(OS_CHROMEOS) |
8 // For GdkScreen | 8 // For GdkScreen |
9 #include <gdk/gdk.h> | 9 #include <gdk/gdk.h> |
10 #endif // defined(OS_CHROMEOS) | 10 #endif // defined(OS_CHROMEOS) |
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1169 // When it's the first load, we know either the pending one or the committed | 1169 // When it's the first load, we know either the pending one or the committed |
1170 // one will have the DOM UI in it (see GetDOMUIForCurrentState), and only one | 1170 // one will have the DOM UI in it (see GetDOMUIForCurrentState), and only one |
1171 // of them will be valid, so we can just check both. | 1171 // of them will be valid, so we can just check both. |
1172 if (render_manager_.pending_dom_ui()) | 1172 if (render_manager_.pending_dom_ui()) |
1173 return render_manager_.pending_dom_ui()->force_bookmark_bar_visible(); | 1173 return render_manager_.pending_dom_ui()->force_bookmark_bar_visible(); |
1174 if (render_manager_.dom_ui()) | 1174 if (render_manager_.dom_ui()) |
1175 return render_manager_.dom_ui()->force_bookmark_bar_visible(); | 1175 return render_manager_.dom_ui()->force_bookmark_bar_visible(); |
1176 return false; // Default. | 1176 return false; // Default. |
1177 } | 1177 } |
1178 | 1178 |
1179 bool TabContents::IsExtensionShelfAlwaysVisible() { | |
1180 // See GetDOMUIForCurrentState() comment for more info. This case is very | |
1181 // similar, but for non-first loads, we want to use the committed entry. This | |
1182 // is so the bookmarks bar disappears at the same time the page does. | |
1183 if (controller_.GetLastCommittedEntry()) { | |
1184 // Not the first load, always use the committed DOM UI. | |
1185 if (render_manager_.dom_ui()) | |
1186 return render_manager_.dom_ui()->force_extension_shelf_visible(); | |
1187 return false; // Default. | |
1188 } | |
1189 | |
1190 // When it's the first load, we know either the pending one or the committed | |
1191 // one will have the DOM UI in it (see GetDOMUIForCurrentState), and only one | |
1192 // of them will be valid, so we can just check both. | |
1193 if (render_manager_.pending_dom_ui()) | |
1194 return render_manager_.pending_dom_ui()->force_extension_shelf_visible(); | |
1195 if (render_manager_.dom_ui()) | |
1196 return render_manager_.dom_ui()->force_extension_shelf_visible(); | |
1197 return false; // Default. | |
1198 } | |
1199 | |
1200 void TabContents::ToolbarSizeChanged(bool is_animating) { | 1179 void TabContents::ToolbarSizeChanged(bool is_animating) { |
1201 TabContentsDelegate* d = delegate(); | 1180 TabContentsDelegate* d = delegate(); |
1202 if (d) | 1181 if (d) |
1203 d->ToolbarSizeChanged(this, is_animating); | 1182 d->ToolbarSizeChanged(this, is_animating); |
1204 } | 1183 } |
1205 | 1184 |
1206 bool TabContents::CanDownload(int request_id) { | 1185 bool TabContents::CanDownload(int request_id) { |
1207 TabContentsDelegate* d = delegate(); | 1186 TabContentsDelegate* d = delegate(); |
1208 if (d) | 1187 if (d) |
1209 return d->CanDownload(request_id); | 1188 return d->CanDownload(request_id); |
(...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2374 Details<RenderViewHost>(rvh)); | 2353 Details<RenderViewHost>(rvh)); |
2375 render_manager_.RenderViewDeleted(rvh); | 2354 render_manager_.RenderViewDeleted(rvh); |
2376 } | 2355 } |
2377 | 2356 |
2378 void TabContents::DidNavigate(RenderViewHost* rvh, | 2357 void TabContents::DidNavigate(RenderViewHost* rvh, |
2379 const ViewHostMsg_FrameNavigate_Params& params) { | 2358 const ViewHostMsg_FrameNavigate_Params& params) { |
2380 int extra_invalidate_flags = 0; | 2359 int extra_invalidate_flags = 0; |
2381 | 2360 |
2382 if (PageTransition::IsMainFrame(params.transition)) { | 2361 if (PageTransition::IsMainFrame(params.transition)) { |
2383 bool was_bookmark_bar_visible = ShouldShowBookmarkBar(); | 2362 bool was_bookmark_bar_visible = ShouldShowBookmarkBar(); |
2384 bool was_extension_shelf_visible = IsExtensionShelfAlwaysVisible(); | |
2385 | 2363 |
2386 render_manager_.DidNavigateMainFrame(rvh); | 2364 render_manager_.DidNavigateMainFrame(rvh); |
2387 | 2365 |
2388 if (was_bookmark_bar_visible != ShouldShowBookmarkBar()) | 2366 if (was_bookmark_bar_visible != ShouldShowBookmarkBar()) |
2389 extra_invalidate_flags |= INVALIDATE_BOOKMARK_BAR; | 2367 extra_invalidate_flags |= INVALIDATE_BOOKMARK_BAR; |
2390 if (was_extension_shelf_visible != IsExtensionShelfAlwaysVisible()) | |
2391 extra_invalidate_flags |= INVALIDATE_EXTENSION_SHELF; | |
2392 } | 2368 } |
2393 | 2369 |
2394 // Update the site of the SiteInstance if it doesn't have one yet. | 2370 // Update the site of the SiteInstance if it doesn't have one yet. |
2395 if (!GetSiteInstance()->has_site()) | 2371 if (!GetSiteInstance()->has_site()) |
2396 GetSiteInstance()->SetSite(params.url); | 2372 GetSiteInstance()->SetSite(params.url); |
2397 | 2373 |
2398 // Need to update MIME type here because it's referred to in | 2374 // Need to update MIME type here because it's referred to in |
2399 // UpdateNavigationCommands() called by RendererDidNavigate() to | 2375 // UpdateNavigationCommands() called by RendererDidNavigate() to |
2400 // determine whether or not to enable the encoding menu. | 2376 // determine whether or not to enable the encoding menu. |
2401 // It's updated only for the main frame. For a subframe, | 2377 // It's updated only for the main frame. For a subframe, |
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3333 AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save)); | 3309 AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save)); |
3334 } | 3310 } |
3335 | 3311 |
3336 Profile* TabContents::GetProfileForPasswordManager() { | 3312 Profile* TabContents::GetProfileForPasswordManager() { |
3337 return profile(); | 3313 return profile(); |
3338 } | 3314 } |
3339 | 3315 |
3340 bool TabContents::DidLastPageLoadEncounterSSLErrors() { | 3316 bool TabContents::DidLastPageLoadEncounterSSLErrors() { |
3341 return controller().ssl_manager()->ProcessedSSLErrorFromRequest(); | 3317 return controller().ssl_manager()->ProcessedSSLErrorFromRequest(); |
3342 } | 3318 } |
OLD | NEW |