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 "ui/views/bubble/bubble_delegate.h" |
| 16 #include "ui/views/controls/button/button.h" |
| 17 |
| 18 class Profile; |
| 19 |
| 20 namespace base { |
| 21 class DictionaryValue; |
| 22 } |
| 23 |
| 24 namespace ui { |
| 25 class ThrobAnimation; |
| 26 } |
| 27 |
| 28 namespace views { |
| 29 class Checkbox; |
| 30 class Label; |
| 31 class RadioButton; |
| 32 class TextButton; |
| 33 } |
| 34 |
| 35 // ChromeToMobileBubbleView is a bubble view for the Chrome To Mobile service. |
| 36 class ChromeToMobileBubbleView : public views::BubbleDelegateView, |
| 37 public views::ButtonListener, |
| 38 public ChromeToMobileService::Observer { |
| 39 public: |
| 40 virtual ~ChromeToMobileBubbleView(); |
| 41 |
| 42 static void ShowBubble(views::View* anchor_view, Profile* profile); |
| 43 static bool IsShowing(); |
| 44 static void Hide(); |
| 45 |
| 46 // views::BubbleDelegateView methods. |
| 47 virtual views::View* GetInitiallyFocusedView() OVERRIDE; |
| 48 virtual gfx::Rect GetAnchorRect() OVERRIDE; |
| 49 virtual void WindowClosing() OVERRIDE; |
| 50 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; |
| 51 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
| 52 |
| 53 // views::ButtonListener method. |
| 54 virtual void ButtonPressed(views::Button* sender, |
| 55 const views::Event& event) OVERRIDE; |
| 56 |
| 57 // ChromeToMobileService::Observer methods. |
| 58 virtual void SnapshotGenerated(const FilePath& path, int64 bytes) OVERRIDE; |
| 59 virtual void OnSendComplete(bool success) OVERRIDE; |
| 60 |
| 61 protected: |
| 62 // views::BubbleDelegateView method. |
| 63 virtual void Init() OVERRIDE; |
| 64 |
| 65 private: |
| 66 ChromeToMobileBubbleView(views::View* anchor_view, Profile* profile); |
| 67 |
| 68 // Handle the message when the user presses a button. |
| 69 void HandleButtonPressed(views::Button* sender); |
| 70 |
| 71 // Send the page to the mobile device. |
| 72 void Send(); |
| 73 |
| 74 // The Chrome To Mobile bubble, if we're showing one. |
| 75 static ChromeToMobileBubbleView* bubble_; |
| 76 |
| 77 base::WeakPtrFactory<ChromeToMobileBubbleView> weak_ptr_factory_; |
| 78 |
| 79 Profile* profile_; |
| 80 |
| 81 // A map of radio buttons for each mobile device to the device's information. |
| 82 typedef std::map<views::RadioButton*, base::DictionaryValue*> DeviceMap; |
| 83 DeviceMap mobile_map_; |
| 84 |
| 85 // The currently selected (or solitary) mobile device's info. |
| 86 base::DictionaryValue* selected_mobile_; |
| 87 |
| 88 // The file path for the MHTML page snapshot. |
| 89 FilePath snapshot_path_; |
| 90 |
| 91 views::Checkbox* send_copy_; |
| 92 views::TextButton* send_; |
| 93 views::TextButton* cancel_; |
| 94 |
| 95 // The label indicating "Sending..."/"Sent" progress after invoking "Send". |
| 96 views::Label* progress_label_; |
| 97 |
| 98 // An animation used to cycle through the "Sending..." status messages. |
| 99 scoped_ptr<ui::ThrobAnimation> progress_animation_; |
| 100 |
| 101 DISALLOW_COPY_AND_ASSIGN(ChromeToMobileBubbleView); |
| 102 }; |
| 103 |
| 104 #endif // CHROME_BROWSER_UI_VIEWS_CHROME_TO_MOBILE_BUBBLE_VIEW_H_ |
OLD | NEW |