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

Side by Side Diff: chrome/renderer/chrome_render_view_observer.cc

Issue 10855151: Gradient overlay for constrained window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chromeos Created 8 years, 4 months 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer/chrome_render_view_observer.h" 5 #include "chrome/renderer/chrome_render_view_observer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "chrome/common/chrome_constants.h" 14 #include "chrome/common/chrome_constants.h"
15 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
16 #include "chrome/common/icon_messages.h" 16 #include "chrome/common/icon_messages.h"
17 #include "chrome/common/prerender_messages.h" 17 #include "chrome/common/prerender_messages.h"
18 #include "chrome/common/render_messages.h" 18 #include "chrome/common/render_messages.h"
19 #include "chrome/common/thumbnail_score.h" 19 #include "chrome/common/thumbnail_score.h"
20 #include "chrome/common/thumbnail_support.h" 20 #include "chrome/common/thumbnail_support.h"
21 #include "chrome/common/url_constants.h" 21 #include "chrome/common/url_constants.h"
22 #include "chrome/renderer/chrome_render_process_observer.h" 22 #include "chrome/renderer/chrome_render_process_observer.h"
23 #include "chrome/renderer/content_settings_observer.h" 23 #include "chrome/renderer/content_settings_observer.h"
24 #include "chrome/renderer/extensions/dispatcher.h" 24 #include "chrome/renderer/extensions/dispatcher.h"
25 #include "chrome/renderer/external_host_bindings.h" 25 #include "chrome/renderer/external_host_bindings.h"
26 #include "chrome/renderer/frame_sniffer.h" 26 #include "chrome/renderer/frame_sniffer.h"
27 #include "chrome/renderer/prerender/prerender_helper.h" 27 #include "chrome/renderer/prerender/prerender_helper.h"
28 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h" 28 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h"
29 #include "chrome/renderer/translate_helper.h" 29 #include "chrome/renderer/translate_helper.h"
30 #include "chrome/renderer/webview_animating_overlay.h"
30 #include "chrome/renderer/webview_color_overlay.h" 31 #include "chrome/renderer/webview_color_overlay.h"
31 #include "content/public/common/bindings_policy.h" 32 #include "content/public/common/bindings_policy.h"
32 #include "content/public/renderer/render_view.h" 33 #include "content/public/renderer/render_view.h"
33 #include "content/public/renderer/content_renderer_client.h" 34 #include "content/public/renderer/content_renderer_client.h"
34 #include "net/base/data_url.h" 35 #include "net/base/data_url.h"
35 #include "skia/ext/image_operations.h" 36 #include "skia/ext/image_operations.h"
36 #include "skia/ext/platform_canvas.h" 37 #include "skia/ext/platform_canvas.h"
37 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityObjec t.h" 38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityObjec t.h"
38 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h " 39 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h "
39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" 40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h"
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 bool enable_phishing_detection) { 375 bool enable_phishing_detection) {
375 #if defined(ENABLE_SAFE_BROWSING) && !defined(OS_CHROMEOS) 376 #if defined(ENABLE_SAFE_BROWSING) && !defined(OS_CHROMEOS)
376 phishing_classifier_ = enable_phishing_detection ? 377 phishing_classifier_ = enable_phishing_detection ?
377 safe_browsing::PhishingClassifierDelegate::Create( 378 safe_browsing::PhishingClassifierDelegate::Create(
378 render_view(), NULL) : 379 render_view(), NULL) :
379 NULL; 380 NULL;
380 #endif 381 #endif
381 } 382 }
382 383
383 void ChromeRenderViewObserver::OnSetVisuallyDeemphasized(bool deemphasized) { 384 void ChromeRenderViewObserver::OnSetVisuallyDeemphasized(bool deemphasized) {
384 bool already_deemphasized = !!dimmed_color_overlay_.get(); 385 if (CommandLine::ForCurrentProcess()->HasSwitch(
385 if (already_deemphasized == deemphasized) 386 switches::kEnableFramelessConstrainedDialogs)) {
386 return; 387 if (!dimmed_animating_overlay_.get()) {
388 dimmed_animating_overlay_.reset(
389 new WebViewAnimatingOverlay(render_view()));
390 }
391 if (deemphasized)
392 dimmed_animating_overlay_->Show();
393 else
394 dimmed_animating_overlay_->Hide();
395 } else {
396 bool already_deemphasized = !!dimmed_color_overlay_.get();
397 if (already_deemphasized == deemphasized)
398 return;
387 399
388 if (deemphasized) { 400 if (deemphasized) {
389 // 70% opaque grey. 401 // 70% opaque grey.
390 SkColor greyish = SkColorSetARGB(178, 0, 0, 0); 402 SkColor greyish = SkColorSetARGB(178, 0, 0, 0);
391 dimmed_color_overlay_.reset( 403 dimmed_color_overlay_.reset(
392 new WebViewColorOverlay(render_view(), greyish)); 404 new WebViewColorOverlay(render_view(), greyish));
393 } else { 405 } else {
394 dimmed_color_overlay_.reset(); 406 dimmed_color_overlay_.reset();
407 }
395 } 408 }
396 } 409 }
397 410
398 void ChromeRenderViewObserver::OnStartFrameSniffer(const string16& frame_name) { 411 void ChromeRenderViewObserver::OnStartFrameSniffer(const string16& frame_name) {
399 new FrameSniffer(render_view(), frame_name); 412 new FrameSniffer(render_view(), frame_name);
400 } 413 }
401 414
402 void ChromeRenderViewObserver::OnGetFPS() { 415 void ChromeRenderViewObserver::OnGetFPS() {
403 float fps = (render_view()->GetFilteredTimePerFrame() > 0.0f)? 416 float fps = (render_view()->GetFilteredTimePerFrame() > 0.0f)?
404 1.0f / render_view()->GetFilteredTimePerFrame() : 0.0f; 417 1.0f / render_view()->GetFilteredTimePerFrame() : 0.0f;
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 reinterpret_cast<const unsigned char*>(&data[0]); 1107 reinterpret_cast<const unsigned char*>(&data[0]);
1095 1108
1096 return decoder.Decode(src_data, data.size()); 1109 return decoder.Decode(src_data, data.size());
1097 } 1110 }
1098 return SkBitmap(); 1111 return SkBitmap();
1099 } 1112 }
1100 1113
1101 bool ChromeRenderViewObserver::IsStrictSecurityHost(const std::string& host) { 1114 bool ChromeRenderViewObserver::IsStrictSecurityHost(const std::string& host) {
1102 return (strict_security_hosts_.find(host) != strict_security_hosts_.end()); 1115 return (strict_security_hosts_.find(host) != strict_security_hosts_.end());
1103 } 1116 }
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_render_view_observer.h ('k') | chrome/renderer/webview_animating_overlay.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698