OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 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_VIEWS_OPTIONS_GEOLOCATION_EXCEPTIONS_VIEW_H_ |
| 6 #define CHROME_BROWSER_VIEWS_OPTIONS_GEOLOCATION_EXCEPTIONS_VIEW_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "chrome/browser/geolocation/geolocation_content_settings_table_model.h" |
| 11 #include "chrome/common/content_settings.h" |
| 12 #include "views/controls/button/button.h" |
| 13 #include "views/controls/table/table_view_observer.h" |
| 14 #include "views/window/dialog_delegate.h" |
| 15 |
| 16 class GeolocationContentSettingsMap; |
| 17 |
| 18 namespace views { |
| 19 class NativeButton; |
| 20 class TableView; |
| 21 } |
| 22 |
| 23 // GeolocationExceptionsView is responsible for showing the user the set of |
| 24 // site-specific geolocation permissions. The exceptions are shown in a table |
| 25 // view by way of a GeolocationContentSettingsTableModel. The user can remove |
| 26 // exceptions. |
| 27 // Use the ShowExceptionsWindow method to create and show a |
| 28 // GeolocationExceptionsView, which is deleted when the window closes. |
| 29 class GeolocationExceptionsView : public views::View, |
| 30 public views::ButtonListener, |
| 31 public views::DialogDelegate, |
| 32 public views::TableViewObserver { |
| 33 public: |
| 34 // Shows the Exceptions window. |
| 35 static void ShowExceptionsWindow(gfx::NativeWindow parent, |
| 36 GeolocationContentSettingsMap* map); |
| 37 |
| 38 virtual ~GeolocationExceptionsView(); |
| 39 |
| 40 // TableViewObserver overrides: |
| 41 virtual void OnSelectionChanged(); |
| 42 virtual void OnTableViewDelete(views::TableView* table_view); |
| 43 |
| 44 // views::ButtonListener implementation. |
| 45 virtual void ButtonPressed(views::Button* sender, const views::Event& event); |
| 46 |
| 47 // views::View overrides: |
| 48 virtual void Layout(); |
| 49 virtual gfx::Size GetPreferredSize(); |
| 50 virtual void ViewHierarchyChanged(bool is_add, |
| 51 views::View* parent, |
| 52 views::View* child); |
| 53 |
| 54 // views::WindowDelegate implementation. |
| 55 virtual int GetDialogButtons() const { |
| 56 return MessageBoxFlags::DIALOGBUTTON_CANCEL; |
| 57 } |
| 58 virtual bool CanResize() const { return true; } |
| 59 virtual std::wstring GetWindowTitle() const; |
| 60 virtual views::View* GetContentsView() { return this; } |
| 61 |
| 62 private: |
| 63 explicit GeolocationExceptionsView(GeolocationContentSettingsMap* map); |
| 64 |
| 65 void Init(); |
| 66 |
| 67 // Resets the enabled state of the buttons from the model. |
| 68 void UpdateButtonState(); |
| 69 |
| 70 // Returns the set of selected rows. |
| 71 GeolocationContentSettingsTableModel::Rows GetSelectedRows() const; |
| 72 |
| 73 // Removes the selected item. |
| 74 void Remove(); |
| 75 |
| 76 // Removes all. |
| 77 void RemoveAll(); |
| 78 |
| 79 // The model displayed in the table. |
| 80 GeolocationContentSettingsTableModel model_; |
| 81 |
| 82 views::TableView* table_; |
| 83 |
| 84 views::NativeButton* remove_button_; |
| 85 views::NativeButton* remove_all_button_; |
| 86 |
| 87 DISALLOW_COPY_AND_ASSIGN(GeolocationExceptionsView); |
| 88 }; |
| 89 |
| 90 #endif // CHROME_BROWSER_VIEWS_OPTIONS_GEOLOCATION_EXCEPTIONS_VIEW_H_ |
| 91 |
OLD | NEW |