OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/extensions/api/tab_capture/tab_capture_registry.h" | 5 #include "chrome/browser/extensions/api/tab_capture/tab_capture_registry.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/sessions/session_tab_helper.h" | 9 #include "chrome/browser/sessions/session_tab_helper.h" |
10 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 registry_->DispatchStatusChangeEvent(this); | 89 registry_->DispatchStatusChangeEvent(this); |
90 } | 90 } |
91 | 91 |
92 void GetCaptureInfo(tab_capture::CaptureInfo* info) const { | 92 void GetCaptureInfo(tab_capture::CaptureInfo* info) const { |
93 info->tab_id = SessionTabHelper::IdForTab(web_contents()); | 93 info->tab_id = SessionTabHelper::IdForTab(web_contents()); |
94 info->status = capture_state_; | 94 info->status = capture_state_; |
95 info->fullscreen = is_fullscreened_; | 95 info->fullscreen = is_fullscreened_; |
96 } | 96 } |
97 | 97 |
98 protected: | 98 protected: |
99 virtual void DidShowFullscreenWidget(int routing_id) OVERRIDE { | 99 virtual void DidShowFullscreenWidget(int routing_id) override { |
100 is_fullscreened_ = true; | 100 is_fullscreened_ = true; |
101 if (capture_state_ == tab_capture::TAB_CAPTURE_STATE_ACTIVE) | 101 if (capture_state_ == tab_capture::TAB_CAPTURE_STATE_ACTIVE) |
102 registry_->DispatchStatusChangeEvent(this); | 102 registry_->DispatchStatusChangeEvent(this); |
103 } | 103 } |
104 | 104 |
105 virtual void DidDestroyFullscreenWidget(int routing_id) OVERRIDE { | 105 virtual void DidDestroyFullscreenWidget(int routing_id) override { |
106 is_fullscreened_ = false; | 106 is_fullscreened_ = false; |
107 if (capture_state_ == tab_capture::TAB_CAPTURE_STATE_ACTIVE) | 107 if (capture_state_ == tab_capture::TAB_CAPTURE_STATE_ACTIVE) |
108 registry_->DispatchStatusChangeEvent(this); | 108 registry_->DispatchStatusChangeEvent(this); |
109 } | 109 } |
110 | 110 |
111 virtual void DidToggleFullscreenModeForTab(bool entered_fullscreen) OVERRIDE { | 111 virtual void DidToggleFullscreenModeForTab(bool entered_fullscreen) override { |
112 is_fullscreened_ = entered_fullscreen; | 112 is_fullscreened_ = entered_fullscreen; |
113 if (capture_state_ == tab_capture::TAB_CAPTURE_STATE_ACTIVE) | 113 if (capture_state_ == tab_capture::TAB_CAPTURE_STATE_ACTIVE) |
114 registry_->DispatchStatusChangeEvent(this); | 114 registry_->DispatchStatusChangeEvent(this); |
115 } | 115 } |
116 | 116 |
117 virtual void WebContentsDestroyed() OVERRIDE { | 117 virtual void WebContentsDestroyed() override { |
118 registry_->KillRequest(this); // Deletes |this|. | 118 registry_->KillRequest(this); // Deletes |this|. |
119 } | 119 } |
120 | 120 |
121 private: | 121 private: |
122 const std::string extension_id_; | 122 const std::string extension_id_; |
123 TabCaptureRegistry* const registry_; | 123 TabCaptureRegistry* const registry_; |
124 TabCaptureState capture_state_; | 124 TabCaptureState capture_state_; |
125 bool is_verified_; | 125 bool is_verified_; |
126 bool is_fullscreened_; | 126 bool is_fullscreened_; |
127 | 127 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 it != requests_.end(); ++it) { | 348 it != requests_.end(); ++it) { |
349 if ((*it) == request) { | 349 if ((*it) == request) { |
350 requests_.erase(it); | 350 requests_.erase(it); |
351 return; | 351 return; |
352 } | 352 } |
353 } | 353 } |
354 NOTREACHED(); | 354 NOTREACHED(); |
355 } | 355 } |
356 | 356 |
357 } // namespace extensions | 357 } // namespace extensions |
OLD | NEW |