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 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1516 *enable_decrement = *enable_increment = false; | 1516 *enable_decrement = *enable_increment = false; |
1517 int percent = static_cast<int>( | 1517 int percent = static_cast<int>( |
1518 WebKit::WebView::zoomLevelToZoomFactor(GetZoomLevel()) * 100); | 1518 WebKit::WebView::zoomLevelToZoomFactor(GetZoomLevel()) * 100); |
1519 *enable_decrement = percent > minimum_zoom_percent_; | 1519 *enable_decrement = percent > minimum_zoom_percent_; |
1520 *enable_increment = percent < maximum_zoom_percent_; | 1520 *enable_increment = percent < maximum_zoom_percent_; |
1521 return percent; | 1521 return percent; |
1522 } | 1522 } |
1523 | 1523 |
1524 void TabContents::ViewSource() | 1524 void TabContents::ViewSource() |
1525 { | 1525 { |
1526 if (delegate_) | 1526 if (!delegate_) |
1527 delegate_->ViewSourceForTab(this); | 1527 return; |
| 1528 |
| 1529 NavigationEntry* active_entry = controller().GetActiveEntry(); |
| 1530 if (!active_entry) |
| 1531 return; |
| 1532 |
| 1533 delegate_->ViewSourceForTab(this, active_entry->url()); |
1528 } | 1534 } |
1529 | 1535 |
1530 // Notifies the RenderWidgetHost instance about the fact that the page is | 1536 // Notifies the RenderWidgetHost instance about the fact that the page is |
1531 // loading, or done loading and calls the base implementation. | 1537 // loading, or done loading and calls the base implementation. |
1532 void TabContents::SetIsLoading(bool is_loading, | 1538 void TabContents::SetIsLoading(bool is_loading, |
1533 LoadNotificationDetails* details) { | 1539 LoadNotificationDetails* details) { |
1534 if (is_loading == is_loading_) | 1540 if (is_loading == is_loading_) |
1535 return; | 1541 return; |
1536 | 1542 |
1537 if (!is_loading) { | 1543 if (!is_loading) { |
(...skipping 1769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3307 } | 3313 } |
3308 | 3314 |
3309 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { | 3315 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { |
3310 render_manager_.SwapInRenderViewHost(rvh); | 3316 render_manager_.SwapInRenderViewHost(rvh); |
3311 } | 3317 } |
3312 | 3318 |
3313 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 3319 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
3314 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 3320 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
3315 rwh_view->SetSize(view()->GetContainerSize()); | 3321 rwh_view->SetSize(view()->GetContainerSize()); |
3316 } | 3322 } |
OLD | NEW |