OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_VIEWS_CHROME_TO_MOBILE_BUBBLE_VIEW_H_ | |
6 #define CHROME_BROWSER_UI_VIEWS_CHROME_TO_MOBILE_BUBBLE_VIEW_H_ | |
7 #pragma once | |
8 | |
9 #include <map> | |
10 | |
11 #include "base/basictypes.h" | |
12 #include "base/compiler_specific.h" | |
13 #include "base/memory/weak_ptr.h" | |
14 #include "chrome/browser/chrome_to_mobile_service.h" | |
15 #include "chrome/common/guid.h" | |
16 #include "ui/views/bubble/bubble_delegate.h" | |
17 #include "ui/views/controls/button/button.h" | |
18 | |
19 class Profile; | |
20 | |
21 namespace base { | |
22 class DictionaryValue; | |
23 } | |
24 | |
25 namespace ui { | |
26 class ThrobAnimation; | |
27 } | |
28 | |
29 namespace views { | |
30 class Checkbox; | |
31 class Label; | |
32 class RadioButton; | |
33 class TextButton; | |
34 } | |
35 | |
36 // ChromeToMobileBubbleView is a bubble view for the Chrome To Mobile service. | |
37 // Don't create a ChromeToMobileBubbleView directly, use ShowBubble method. | |
sky
2012/03/11 21:41:22
nit: update comment as you can't really create a C
msw
2012/03/12 10:17:18
Good point, removed that sentence.
| |
38 class ChromeToMobileBubbleView : public views::BubbleDelegateView, | |
39 public ChromeToMobileService::Observer, | |
40 public views::ButtonListener { | |
41 public: | |
42 static void ShowBubble(views::View* anchor_view, Profile* profile); | |
43 static bool IsShowing(); | |
44 static void Hide(); | |
45 | |
46 virtual ~ChromeToMobileBubbleView(); | |
sky
2012/03/11 21:41:22
destructor before static emthods.
msw
2012/03/12 10:17:18
Done.
| |
47 | |
48 // views::BubbleDelegateView methods. | |
49 virtual views::View* GetInitiallyFocusedView() OVERRIDE; | |
50 virtual gfx::Rect GetAnchorRect() OVERRIDE; | |
51 | |
52 // views::WidgetDelegate method. | |
53 virtual void WindowClosing() OVERRIDE; | |
54 | |
55 // views::View method. | |
56 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; | |
57 | |
58 // ChromeToMobileService::Observer method. | |
59 virtual void OnSendComplete(bool success) OVERRIDE; | |
60 | |
61 // views::AnimationDelegate method. | |
62 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | |
63 | |
64 // Called upon generation of the page's MHTML snapshot. | |
sky
2012/03/11 21:41:22
nit: typically overriden virtual methods are last
msw
2012/03/12 10:17:18
Moot here with latest code, but thanks for the tip
| |
65 void SnapshotGenerated(const FilePath& snapshot_path, int64 snapshot_bytes); | |
66 | |
67 protected: | |
68 // views::BubbleDelegateView method. | |
69 virtual void Init() OVERRIDE; | |
70 | |
71 private: | |
72 ChromeToMobileBubbleView(views::View* anchor_view, Profile* profile); | |
73 | |
74 // Overridden from views::ButtonListener: | |
75 virtual void ButtonPressed(views::Button* sender, | |
76 const views::Event& event) OVERRIDE; | |
77 | |
78 // Handle the message when the user presses a button. | |
79 void HandleButtonPressed(views::Button* sender); | |
80 | |
81 // Send the page to the mobile device. | |
82 void Send(); | |
83 | |
84 // The Chrome To Mobile bubble, if we're showing one. | |
85 static ChromeToMobileBubbleView* bubble_; | |
86 | |
87 base::WeakPtrFactory<ChromeToMobileBubbleView> weak_ptr_factory_; | |
88 | |
89 Profile* profile_; | |
90 | |
91 typedef std::map<views::RadioButton*, base::DictionaryValue*> DeviceMap; | |
92 DeviceMap mobile_map_; | |
sky
2012/03/11 21:41:22
Add a description of mobile_map_ and selected_mobi
msw
2012/03/12 10:17:18
Done.
| |
93 base::DictionaryValue* selected_mobile_; | |
sky
2012/03/11 21:41:22
Initialize this to NULL.
msw
2012/03/12 10:17:18
Done.
| |
94 | |
95 FilePath snapshot_path_; | |
96 views::Checkbox* send_copy_; | |
97 | |
98 views::TextButton* send_; | |
99 views::TextButton* cancel_; | |
100 | |
101 views::Label* progress_label_; | |
102 size_t progress_periods_count_; | |
sky
2012/03/11 21:41:22
Add a description of this.
msw
2012/03/12 10:17:18
Done.
| |
103 scoped_ptr<ui::ThrobAnimation> progress_animation_; | |
104 | |
105 DISALLOW_COPY_AND_ASSIGN(ChromeToMobileBubbleView); | |
106 }; | |
107 | |
108 #endif // CHROME_BROWSER_UI_VIEWS_CHROME_TO_MOBILE_BUBBLE_VIEW_H_ | |
OLD | NEW |