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

Unified Diff: chrome/browser/ui/views/chrome_to_mobile_bubble_view.h

Issue 9443007: Add Chrome To Mobile Service and Views Page Action. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Put shared CloudPrint consts/helpers in chrome/common/; use CloudPrintURL. Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/chrome_to_mobile_bubble_view.h
diff --git a/chrome/browser/ui/views/chrome_to_mobile_bubble_view.h b/chrome/browser/ui/views/chrome_to_mobile_bubble_view.h
new file mode 100755
index 0000000000000000000000000000000000000000..87c386066310a75a8a4d196bfcf22e30629e9a71
--- /dev/null
+++ b/chrome/browser/ui/views/chrome_to_mobile_bubble_view.h
@@ -0,0 +1,108 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_VIEWS_CHROME_TO_MOBILE_BUBBLE_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_CHROME_TO_MOBILE_BUBBLE_VIEW_H_
+#pragma once
+
+#include <map>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/memory/weak_ptr.h"
+#include "chrome/browser/chrome_to_mobile_service.h"
+#include "chrome/common/guid.h"
+#include "ui/views/bubble/bubble_delegate.h"
+#include "ui/views/controls/button/button.h"
+
+class Profile;
+
+namespace base {
+class DictionaryValue;
+}
+
+namespace ui {
+class ThrobAnimation;
+}
+
+namespace views {
+class Checkbox;
+class Label;
+class RadioButton;
+class TextButton;
+}
+
+// ChromeToMobileBubbleView is a bubble view for the Chrome To Mobile service.
+// 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.
+class ChromeToMobileBubbleView : public views::BubbleDelegateView,
+ public ChromeToMobileService::Observer,
+ public views::ButtonListener {
+ public:
+ static void ShowBubble(views::View* anchor_view, Profile* profile);
+ static bool IsShowing();
+ static void Hide();
+
+ virtual ~ChromeToMobileBubbleView();
sky 2012/03/11 21:41:22 destructor before static emthods.
msw 2012/03/12 10:17:18 Done.
+
+ // views::BubbleDelegateView methods.
+ virtual views::View* GetInitiallyFocusedView() OVERRIDE;
+ virtual gfx::Rect GetAnchorRect() OVERRIDE;
+
+ // views::WidgetDelegate method.
+ virtual void WindowClosing() OVERRIDE;
+
+ // views::View method.
+ virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
+
+ // ChromeToMobileService::Observer method.
+ virtual void OnSendComplete(bool success) OVERRIDE;
+
+ // views::AnimationDelegate method.
+ virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
+
+ // 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
+ void SnapshotGenerated(const FilePath& snapshot_path, int64 snapshot_bytes);
+
+ protected:
+ // views::BubbleDelegateView method.
+ virtual void Init() OVERRIDE;
+
+ private:
+ ChromeToMobileBubbleView(views::View* anchor_view, Profile* profile);
+
+ // Overridden from views::ButtonListener:
+ virtual void ButtonPressed(views::Button* sender,
+ const views::Event& event) OVERRIDE;
+
+ // Handle the message when the user presses a button.
+ void HandleButtonPressed(views::Button* sender);
+
+ // Send the page to the mobile device.
+ void Send();
+
+ // The Chrome To Mobile bubble, if we're showing one.
+ static ChromeToMobileBubbleView* bubble_;
+
+ base::WeakPtrFactory<ChromeToMobileBubbleView> weak_ptr_factory_;
+
+ Profile* profile_;
+
+ typedef std::map<views::RadioButton*, base::DictionaryValue*> DeviceMap;
+ 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.
+ base::DictionaryValue* selected_mobile_;
sky 2012/03/11 21:41:22 Initialize this to NULL.
msw 2012/03/12 10:17:18 Done.
+
+ FilePath snapshot_path_;
+ views::Checkbox* send_copy_;
+
+ views::TextButton* send_;
+ views::TextButton* cancel_;
+
+ views::Label* progress_label_;
+ 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.
+ scoped_ptr<ui::ThrobAnimation> progress_animation_;
+
+ DISALLOW_COPY_AND_ASSIGN(ChromeToMobileBubbleView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_CHROME_TO_MOBILE_BUBBLE_VIEW_H_

Powered by Google App Engine
This is Rietveld 408576698