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

Side by Side Diff: extensions/browser/guest_view/web_view/web_view_guest.cc

Issue 637083002: Sets the default background color of inline signin and user manager to grey (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits fixed Created 6 years, 2 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
OLDNEW
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/web_view/web_view_guest.h" 5 #include "extensions/browser/guest_view/web_view/web_view_guest.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "content/public/browser/browser_context.h" 10 #include "content/public/browser/browser_context.h"
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 370
371 void WebViewGuest::GuestReady() { 371 void WebViewGuest::GuestReady() {
372 // The guest RenderView should always live in an isolated guest process. 372 // The guest RenderView should always live in an isolated guest process.
373 CHECK(web_contents()->GetRenderProcessHost()->IsIsolatedGuest()); 373 CHECK(web_contents()->GetRenderProcessHost()->IsIsolatedGuest());
374 Send(new ExtensionMsg_SetFrameName(web_contents()->GetRoutingID(), name_)); 374 Send(new ExtensionMsg_SetFrameName(web_contents()->GetRoutingID(), name_));
375 375
376 // We don't want to accidentally set the opacity of an interstitial page. 376 // We don't want to accidentally set the opacity of an interstitial page.
377 // WebContents::GetRenderWidgetHostView will return the RWHV of an 377 // WebContents::GetRenderWidgetHostView will return the RWHV of an
378 // interstitial page if one is showing at this time. We only want opacity 378 // interstitial page if one is showing at this time. We only want opacity
379 // to apply to web pages. 379 // to apply to web pages.
380 web_contents()->GetRenderViewHost()->GetView()-> 380 if (guest_opaque_) {
381 SetBackgroundOpaque(guest_opaque_); 381 web_contents()
382 ->GetRenderViewHost()
383 ->GetView()
384 ->FillBackgroundWithDefaultColor();
385 } else {
386 web_contents()->GetRenderViewHost()->GetView()->SetBackgroundColor(
387 SK_ColorTRANSPARENT);
388 }
382 } 389 }
383 390
384 void WebViewGuest::GuestSizeChangedDueToAutoSize(const gfx::Size& old_size, 391 void WebViewGuest::GuestSizeChangedDueToAutoSize(const gfx::Size& old_size,
385 const gfx::Size& new_size) { 392 const gfx::Size& new_size) {
386 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 393 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
387 args->SetInteger(webview::kOldHeight, old_size.height()); 394 args->SetInteger(webview::kOldHeight, old_size.height());
388 args->SetInteger(webview::kOldWidth, old_size.width()); 395 args->SetInteger(webview::kOldWidth, old_size.width());
389 args->SetInteger(webview::kNewHeight, new_size.height()); 396 args->SetInteger(webview::kNewHeight, new_size.height());
390 args->SetInteger(webview::kNewWidth, new_size.width()); 397 args->SetInteger(webview::kNewWidth, new_size.width());
391 DispatchEventToEmbedder( 398 DispatchEventToEmbedder(
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 } 1025 }
1019 1026
1020 void WebViewGuest::SetAllowTransparency(bool allow) { 1027 void WebViewGuest::SetAllowTransparency(bool allow) {
1021 if (guest_opaque_ != allow) 1028 if (guest_opaque_ != allow)
1022 return; 1029 return;
1023 1030
1024 guest_opaque_ = !allow; 1031 guest_opaque_ = !allow;
1025 if (!web_contents()->GetRenderViewHost()->GetView()) 1032 if (!web_contents()->GetRenderViewHost()->GetView())
1026 return; 1033 return;
1027 1034
1028 web_contents()->GetRenderViewHost()->GetView()->SetBackgroundOpaque(!allow); 1035 if (guest_opaque_) {
1036 web_contents()
1037 ->GetRenderViewHost()
1038 ->GetView()
1039 ->FillBackgroundWithDefaultColor();
1040 } else {
1041 web_contents()->GetRenderViewHost()->GetView()->SetBackgroundColor(
1042 SK_ColorTRANSPARENT);
1043 }
1029 } 1044 }
1030 1045
1031 bool WebViewGuest::LoadDataWithBaseURL(const std::string& data_url, 1046 bool WebViewGuest::LoadDataWithBaseURL(const std::string& data_url,
1032 const std::string& base_url, 1047 const std::string& base_url,
1033 const std::string& virtual_url, 1048 const std::string& virtual_url,
1034 std::string* error) { 1049 std::string* error) {
1035 // Make GURLs from URLs. 1050 // Make GURLs from URLs.
1036 const GURL data_gurl = GURL(data_url); 1051 const GURL data_gurl = GURL(data_url);
1037 const GURL base_gurl = GURL(base_url); 1052 const GURL base_gurl = GURL(base_url);
1038 const GURL virtual_gurl = GURL(virtual_url); 1053 const GURL virtual_gurl = GURL(virtual_url);
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1218 WebViewGuest* guest = 1233 WebViewGuest* guest =
1219 WebViewGuest::From(embedder_render_process_id(), new_window_instance_id); 1234 WebViewGuest::From(embedder_render_process_id(), new_window_instance_id);
1220 if (!guest) 1235 if (!guest)
1221 return; 1236 return;
1222 1237
1223 if (!allow) 1238 if (!allow)
1224 guest->Destroy(); 1239 guest->Destroy();
1225 } 1240 }
1226 1241
1227 } // namespace extensions 1242 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698