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

Side by Side Diff: chrome/browser/chromeos/sim_unlock_dialog_delegate.cc

Issue 6776019: [cros] Create SIM unlock dialog wrapper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 9 years, 8 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
(Empty)
1 // Copyright (c) 2011 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/sim_unlock_dialog_delegate.h"
6
7 #include "chrome/browser/browser_list.h"
8 #include "chrome/browser/chromeos/frame/bubble_window.h"
9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/views/html_dialog_view.h"
11 #include "chrome/common/url_constants.h"
12
13 namespace {
14
15 // Default width/height of the dialog.
16 const int kDefaultWidth = 350;
17 const int kDefaultHeight = 225;
18
19 // Custom HtmlDialogView with disabled context menu.
20 class HtmlDialogWithoutContextMenuView : public HtmlDialogView {
21 public:
22 HtmlDialogWithoutContextMenuView(Profile* profile,
23 HtmlDialogUIDelegate* delegate)
24 : HtmlDialogView(profile, delegate) {}
25
26 // TabContentsDelegate implementation.
27 bool HandleContextMenu(const ContextMenuParams& params) {
28 // Disable context menu.
29 return true;
30 }
31 };
32
33 } // namespace
34
35 namespace chromeos {
36
37 // static
38 void SimUnlockDialogDelegate::ShowDialog(gfx::NativeWindow owning_window) {
39 Browser* browser = BrowserList::GetLastActive();
40 HtmlDialogView* html_view = new HtmlDialogWithoutContextMenuView(
41 browser->profile(), new SimUnlockDialogDelegate());
42 html_view->InitDialog();
43 chromeos::BubbleWindow::Create(owning_window,
44 gfx::Rect(),
45 chromeos::BubbleWindow::STYLE_GENERIC,
46 html_view);
47 html_view->window()->Show();
48 }
49
50 SimUnlockDialogDelegate::SimUnlockDialogDelegate() {
51 }
52
53 SimUnlockDialogDelegate::~SimUnlockDialogDelegate() {
54 }
55
56 bool SimUnlockDialogDelegate::IsDialogModal() const {
57 return true;
58 }
59
60 std::wstring SimUnlockDialogDelegate::GetDialogTitle() const {
61 return std::wstring();
62 }
63
64 GURL SimUnlockDialogDelegate::GetDialogContentURL() const {
65 std::string url_string(chrome::kChromeUISimUnlockURL);
66 return GURL(url_string);
67 }
68
69 void SimUnlockDialogDelegate::GetWebUIMessageHandlers(
70 std::vector<WebUIMessageHandler*>* handlers) const {
71 }
72
73 void SimUnlockDialogDelegate::GetDialogSize(gfx::Size* size) const {
74 // TODO(nkostylev): Set custom size based on locale settings.
75 size->SetSize(kDefaultWidth, kDefaultHeight);
76 }
77
78 std::string SimUnlockDialogDelegate::GetDialogArgs() const {
79 return "[]";
80 }
81
82 void SimUnlockDialogDelegate::OnDialogClosed(const std::string& json_retval) {
83 delete this;
84 }
85
86 void SimUnlockDialogDelegate::OnCloseContents(TabContents* source,
87 bool* out_close_dialog) {
88 if (out_close_dialog)
89 *out_close_dialog = true;
90 }
91
92 bool SimUnlockDialogDelegate::ShouldShowDialogTitle() const {
93 return false;
94 }
95
96 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/sim_unlock_dialog_delegate.h ('k') | chrome/browser/chromeos/status/network_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698