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

Side by Side Diff: chrome/browser/tab_contents/tab_contents.cc

Issue 5320001: Disable printing context menus on the print preview page. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix tests Created 10 years 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 | Annotate | Revision Log
OLDNEW
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 #include "chrome/browser/tab_contents/navigation_entry.h" 78 #include "chrome/browser/tab_contents/navigation_entry.h"
79 #include "chrome/browser/tab_contents/provisional_load_details.h" 79 #include "chrome/browser/tab_contents/provisional_load_details.h"
80 #include "chrome/browser/tab_contents/tab_contents_delegate.h" 80 #include "chrome/browser/tab_contents/tab_contents_delegate.h"
81 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" 81 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h"
82 #include "chrome/browser/tab_contents/tab_contents_view.h" 82 #include "chrome/browser/tab_contents/tab_contents_view.h"
83 #include "chrome/browser/tab_contents/thumbnail_generator.h" 83 #include "chrome/browser/tab_contents/thumbnail_generator.h"
84 #include "chrome/browser/tab_contents/web_navigation_observer.h" 84 #include "chrome/browser/tab_contents/web_navigation_observer.h"
85 #include "chrome/browser/translate/page_translated_details.h" 85 #include "chrome/browser/translate/page_translated_details.h"
86 #include "chrome/common/bindings_policy.h" 86 #include "chrome/common/bindings_policy.h"
87 #include "chrome/common/chrome_switches.h" 87 #include "chrome/common/chrome_switches.h"
88 #include "chrome/common/content_restriction.h"
88 #include "chrome/common/extensions/extension.h" 89 #include "chrome/common/extensions/extension.h"
89 #include "chrome/common/extensions/extension_action.h" 90 #include "chrome/common/extensions/extension_action.h"
90 #include "chrome/common/extensions/extension_icon_set.h" 91 #include "chrome/common/extensions/extension_icon_set.h"
91 #include "chrome/common/extensions/extension_resource.h" 92 #include "chrome/common/extensions/extension_resource.h"
92 #include "chrome/common/extensions/url_pattern.h" 93 #include "chrome/common/extensions/url_pattern.h"
93 #include "chrome/common/navigation_types.h" 94 #include "chrome/common/navigation_types.h"
94 #include "chrome/common/net/url_request_context_getter.h" 95 #include "chrome/common/net/url_request_context_getter.h"
95 #include "chrome/common/notification_service.h" 96 #include "chrome/common/notification_service.h"
96 #include "chrome/common/pref_names.h" 97 #include "chrome/common/pref_names.h"
97 #include "chrome/common/render_messages.h" 98 #include "chrome/common/render_messages.h"
(...skipping 2543 matching lines...) Expand 10 before | Expand all | Expand 10 after
2641 } 2642 }
2642 2643
2643 void TabContents::RequestMove(const gfx::Rect& new_bounds) { 2644 void TabContents::RequestMove(const gfx::Rect& new_bounds) {
2644 if (delegate() && delegate()->IsPopup(this)) 2645 if (delegate() && delegate()->IsPopup(this))
2645 delegate()->MoveContents(this, new_bounds); 2646 delegate()->MoveContents(this, new_bounds);
2646 } 2647 }
2647 2648
2648 void TabContents::DidStartLoading() { 2649 void TabContents::DidStartLoading() {
2649 SetIsLoading(true, NULL); 2650 SetIsLoading(true, NULL);
2650 2651
2651 if (content_restrictions_) { 2652 if (delegate()) {
2652 content_restrictions_= 0; 2653 bool is_print_preview_tab =
2653 delegate()->ContentRestrictionsChanged(this); 2654 printing::PrintPreviewTabController::IsPrintPreviewTab(this);
2655 if (content_restrictions_ || is_print_preview_tab) {
2656 content_restrictions_= is_print_preview_tab ?
2657 CONTENT_RESTRICTION_PRINT : 0;
2658 delegate()->ContentRestrictionsChanged(this);
2659 }
2654 } 2660 }
2655 2661
2656 // Notify observers about navigation. 2662 // Notify observers about navigation.
2657 FOR_EACH_OBSERVER(WebNavigationObserver, web_navigation_observers_, 2663 FOR_EACH_OBSERVER(WebNavigationObserver, web_navigation_observers_,
2658 DidStartLoading()); 2664 DidStartLoading());
2659 } 2665 }
2660 2666
2661 void TabContents::DidStopLoading() { 2667 void TabContents::DidStopLoading() {
2662 scoped_ptr<LoadNotificationDetails> details; 2668 scoped_ptr<LoadNotificationDetails> details;
2663 2669
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
3240 } 3246 }
3241 3247
3242 void TabContents::set_encoding(const std::string& encoding) { 3248 void TabContents::set_encoding(const std::string& encoding) {
3243 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); 3249 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding);
3244 } 3250 }
3245 3251
3246 void TabContents::SetAppIcon(const SkBitmap& app_icon) { 3252 void TabContents::SetAppIcon(const SkBitmap& app_icon) {
3247 app_icon_ = app_icon; 3253 app_icon_ = app_icon;
3248 NotifyNavigationStateChanged(INVALIDATE_TITLE); 3254 NotifyNavigationStateChanged(INVALIDATE_TITLE);
3249 } 3255 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698