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

Side by Side Diff: chrome/browser/chromeos/net/network_portal_web_dialog.cc

Issue 750153002: ChromeOS: bypass proxy for captive portal authorization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restore comment. Created 6 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/net/network_portal_web_dialog.h"
6
7 #include "ash/shell.h"
8 #include "components/captive_portal/captive_portal_detector.h"
9 #include "ui/base/ui_base_types.h"
10 #include "ui/gfx/display.h"
11 #include "ui/gfx/size.h"
12 #include "ui/views/widget/widget.h"
13 #include "url/gurl.h"
14
15 namespace {
16
17 const float kNetworkPortalWebDialogWidthFraction = .8;
18 const float kNetworkPortalWebDialogHeightFraction = .8;
19
20 gfx::Size GetPortalDialogSize() {
21 const gfx::Display display = ash::Shell::GetScreen()->GetPrimaryDisplay();
22
23 gfx::Size display_size = display.size();
24
25 if (display.rotation() == gfx::Display::ROTATE_90 ||
26 display.rotation() == gfx::Display::ROTATE_270) {
27 display_size = gfx::Size(display_size.height(), display_size.width());
28 }
29
30 display_size =
31 gfx::Size(display_size.width() * kNetworkPortalWebDialogWidthFraction,
32 display_size.height() * kNetworkPortalWebDialogHeightFraction);
33
34 return display_size;
35 }
36
37 } // namespace
38
39 namespace chromeos {
40
41 NetworkPortalWebDialog::NetworkPortalWebDialog(
42 base::WeakPtr<NetworkPortalNotificationController> controller)
43 : controller_(controller), widget_(NULL) {
ygorshenin1 2014/11/26 16:33:50 nit: s/NULL/nullptr/g
Alexander Alekseev 2014/11/26 17:51:00 Done.
44 }
45
46 NetworkPortalWebDialog::~NetworkPortalWebDialog() {
47 if (controller_)
48 controller_->OnDialogDestroyed(this);
49 }
50
51 void NetworkPortalWebDialog::Close() {
52 if (widget_)
53 widget_->Close();
54 }
55
56 void NetworkPortalWebDialog::SetWidget(views::Widget* widget) {
57 widget_ = widget;
58 }
59
60 ui::ModalType NetworkPortalWebDialog::GetDialogModalType() const {
61 return ui::MODAL_TYPE_SYSTEM;
62 }
63
64 base::string16 NetworkPortalWebDialog::GetDialogTitle() const {
65 return base::string16();
66 }
67
68 GURL NetworkPortalWebDialog::GetDialogContentURL() const {
69 return GURL(captive_portal::CaptivePortalDetector::kDefaultURL);
70 }
71
72 void NetworkPortalWebDialog::GetWebUIMessageHandlers(
73 std::vector<content::WebUIMessageHandler*>* handlers) const {
74 }
75
76 void NetworkPortalWebDialog::GetDialogSize(gfx::Size* size) const {
77 *size = GetPortalDialogSize();
78 }
79
80 std::string NetworkPortalWebDialog::GetDialogArgs() const {
81 return std::string();
82 }
83
84 bool NetworkPortalWebDialog::CanResizeDialog() const {
85 return false;
86 }
87
88 void NetworkPortalWebDialog::OnDialogClosed(const std::string& json_retval) {
89 delete this;
90 }
91
92 void NetworkPortalWebDialog::OnCloseContents(content::WebContents* /* source */,
93 bool* out_close_dialog) {
94 if (out_close_dialog)
95 *out_close_dialog = true;
96 }
97
98 bool NetworkPortalWebDialog::ShouldShowDialogTitle() const {
99 return true;
100 }
101
102 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/net/network_portal_web_dialog.h ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698