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

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: cleanup 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 // Default width/height of the dialog.
whywhat 2011/03/30 19:12:15 Empty line before?
Nikita (slow) 2011/03/31 08:44:17 Done.
15 const int kDefaultWidth = 350;
16 const int kDefaultHeight = 225;
17
18 // Custom HtmlDialogView with disabled context menu.
19 class HtmlDialogWithoutContextMenuView : public HtmlDialogView {
20 public:
21 HtmlDialogWithoutContextMenuView(Profile* profile,
22 HtmlDialogUIDelegate* delegate)
23 : HtmlDialogView(profile, delegate) {}
24 virtual ~HtmlDialogWithoutContextMenuView() {}
whywhat 2011/03/30 19:12:15 I think you can live with auto generated one.
Nikita (slow) 2011/03/31 08:44:17 Done.
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 SimUnlockDialogDelegate::~SimUnlockDialogDelegate() {}
53
54 bool SimUnlockDialogDelegate::IsDialogModal() const {
55 return true;
56 }
57
58 std::wstring SimUnlockDialogDelegate::GetDialogTitle() const {
59 return std::wstring();
60 }
61
62 GURL SimUnlockDialogDelegate::GetDialogContentURL() const {
63 std::string url_string(chrome::kChromeUISimUnlockURL);
64 return GURL(url_string);
65 }
66
67 void SimUnlockDialogDelegate::GetWebUIMessageHandlers(
68 std::vector<WebUIMessageHandler*>* handlers) const {}
whywhat 2011/03/30 19:12:15 Could you move the closing bracket to the next lin
Nikita (slow) 2011/03/30 19:47:55 That would mean that we're inlining virtual functi
whywhat 2011/03/30 20:05:29 Well, I think it's better to leave it in .cc file
Nikita (slow) 2011/03/31 08:44:17 Done.
Nikita (slow) 2011/03/31 08:44:17 Done.
69
70 void SimUnlockDialogDelegate::GetDialogSize(gfx::Size* size) const {
71 // TODO(nkostylev): Set custom size based on locale settings.
72 size->SetSize(kDefaultWidth, kDefaultHeight);
73 }
74
75 std::string SimUnlockDialogDelegate::GetDialogArgs() const {
76 return "[]";
77 }
78
79 void SimUnlockDialogDelegate::OnDialogClosed(const std::string& json_retval) {
80 delete this;
whywhat 2011/03/30 19:12:15 Is this really needed?
Nikita (slow) 2011/03/30 19:47:55 Yes, delegate is created in static method and not
81 return;
whywhat 2011/03/30 20:05:29 You don't need return here.
Nikita (slow) 2011/03/31 08:44:17 Done.
82 }
83
84 void SimUnlockDialogDelegate::OnCloseContents(TabContents* source,
85 bool* out_close_dialog) {
86 if (out_close_dialog)
87 *out_close_dialog = true;
88 }
89
90 bool SimUnlockDialogDelegate::ShouldShowDialogTitle() const {
91 return false;
92 }
93
94 } // 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