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

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: rebased 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 373
374 void WebViewGuest::GuestReady() { 374 void WebViewGuest::GuestReady() {
375 // The guest RenderView should always live in an isolated guest process. 375 // The guest RenderView should always live in an isolated guest process.
376 CHECK(web_contents()->GetRenderProcessHost()->IsIsolatedGuest()); 376 CHECK(web_contents()->GetRenderProcessHost()->IsIsolatedGuest());
377 Send(new ExtensionMsg_SetFrameName(web_contents()->GetRoutingID(), name_)); 377 Send(new ExtensionMsg_SetFrameName(web_contents()->GetRoutingID(), name_));
378 378
379 // We don't want to accidentally set the opacity of an interstitial page. 379 // We don't want to accidentally set the opacity of an interstitial page.
380 // WebContents::GetRenderWidgetHostView will return the RWHV of an 380 // WebContents::GetRenderWidgetHostView will return the RWHV of an
381 // interstitial page if one is showing at this time. We only want opacity 381 // interstitial page if one is showing at this time. We only want opacity
382 // to apply to web pages. 382 // to apply to web pages.
383 web_contents()->GetRenderViewHost()->GetView()-> 383 if (guest_opaque_) {
384 SetBackgroundOpaque(guest_opaque_); 384 web_contents()
385 ->GetRenderViewHost()
386 ->GetView()
387 ->SetBackgroundColorToDefault();
388 } else {
389 web_contents()->GetRenderViewHost()->GetView()->SetBackgroundColor(
390 SK_ColorTRANSPARENT);
391 }
385 if (web_view_guest_delegate_) 392 if (web_view_guest_delegate_)
386 web_view_guest_delegate_->OnGuestReady(); 393 web_view_guest_delegate_->OnGuestReady();
387 } 394 }
388 395
389 void WebViewGuest::GuestSizeChangedDueToAutoSize(const gfx::Size& old_size, 396 void WebViewGuest::GuestSizeChangedDueToAutoSize(const gfx::Size& old_size,
390 const gfx::Size& new_size) { 397 const gfx::Size& new_size) {
391 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 398 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
392 args->SetInteger(webview::kOldHeight, old_size.height()); 399 args->SetInteger(webview::kOldHeight, old_size.height());
393 args->SetInteger(webview::kOldWidth, old_size.width()); 400 args->SetInteger(webview::kOldWidth, old_size.width());
394 args->SetInteger(webview::kNewHeight, new_size.height()); 401 args->SetInteger(webview::kNewHeight, new_size.height());
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 } 1035 }
1029 1036
1030 void WebViewGuest::SetAllowTransparency(bool allow) { 1037 void WebViewGuest::SetAllowTransparency(bool allow) {
1031 if (guest_opaque_ != allow) 1038 if (guest_opaque_ != allow)
1032 return; 1039 return;
1033 1040
1034 guest_opaque_ = !allow; 1041 guest_opaque_ = !allow;
1035 if (!web_contents()->GetRenderViewHost()->GetView()) 1042 if (!web_contents()->GetRenderViewHost()->GetView())
1036 return; 1043 return;
1037 1044
1038 web_contents()->GetRenderViewHost()->GetView()->SetBackgroundOpaque(!allow); 1045 if (guest_opaque_) {
1046 web_contents()
1047 ->GetRenderViewHost()
1048 ->GetView()
1049 ->SetBackgroundColorToDefault();
1050 } else {
1051 web_contents()->GetRenderViewHost()->GetView()->SetBackgroundColor(
1052 SK_ColorTRANSPARENT);
1053 }
1039 } 1054 }
1040 1055
1041 bool WebViewGuest::LoadDataWithBaseURL(const std::string& data_url, 1056 bool WebViewGuest::LoadDataWithBaseURL(const std::string& data_url,
1042 const std::string& base_url, 1057 const std::string& base_url,
1043 const std::string& virtual_url, 1058 const std::string& virtual_url,
1044 std::string* error) { 1059 std::string* error) {
1045 // Make GURLs from URLs. 1060 // Make GURLs from URLs.
1046 const GURL data_gurl = GURL(data_url); 1061 const GURL data_gurl = GURL(data_url);
1047 const GURL base_gurl = GURL(base_url); 1062 const GURL base_gurl = GURL(base_url);
1048 const GURL virtual_gurl = GURL(virtual_url); 1063 const GURL virtual_gurl = GURL(virtual_url);
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1228 WebViewGuest* guest = 1243 WebViewGuest* guest =
1229 WebViewGuest::From(embedder_render_process_id(), new_window_instance_id); 1244 WebViewGuest::From(embedder_render_process_id(), new_window_instance_id);
1230 if (!guest) 1245 if (!guest)
1231 return; 1246 return;
1232 1247
1233 if (!allow) 1248 if (!allow)
1234 guest->Destroy(); 1249 guest->Destroy();
1235 } 1250 }
1236 1251
1237 } // namespace extensions 1252 } // namespace extensions
OLDNEW
« no previous file with comments | « content/public/browser/render_widget_host_view.h ('k') | extensions/components/native_app_window/native_app_window_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698