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

Side by Side Diff: mandoline/tab/frame.cc

Issue 1239313004: More html_viewer OOPIF changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile Created 5 years, 5 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 unified diff | Download patch
« no previous file with comments | « mandoline/tab/frame.h ('k') | mandoline/tab/frame_apptest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "mandoline/tab/frame.h" 5 #include "mandoline/tab/frame.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "components/view_manager/public/cpp/view.h" 10 #include "components/view_manager/public/cpp/view.h"
(...skipping 13 matching lines...) Expand all
24 24
25 namespace { 25 namespace {
26 26
27 const uint32_t kNoParentId = 0u; 27 const uint32_t kNoParentId = 0u;
28 28
29 FrameDataPtr FrameToFrameData(const Frame* frame) { 29 FrameDataPtr FrameToFrameData(const Frame* frame) {
30 FrameDataPtr frame_data(FrameData::New()); 30 FrameDataPtr frame_data(FrameData::New());
31 frame_data->frame_id = frame->view()->id(); 31 frame_data->frame_id = frame->view()->id();
32 frame_data->parent_id = 32 frame_data->parent_id =
33 frame->parent() ? frame->parent()->view()->id() : kNoParentId; 33 frame->parent() ? frame->parent()->view()->id() : kNoParentId;
34 frame_data->name = frame->name();
35 // TODO(sky): implement me.
36 frame_data->origin = std::string();
34 return frame_data.Pass(); 37 return frame_data.Pass();
35 } 38 }
36 39
37 } // namespace 40 } // namespace
38 41
39 Frame::Frame(FrameTree* tree, 42 Frame::Frame(FrameTree* tree,
40 View* view, 43 View* view,
41 ViewOwnership view_ownership, 44 ViewOwnership view_ownership,
42 FrameTreeClient* frame_tree_client, 45 FrameTreeClient* frame_tree_client,
43 scoped_ptr<FrameUserData> user_data) 46 scoped_ptr<FrameUserData> user_data)
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 if (removed_node == this) 171 if (removed_node == this)
169 return; 172 return;
170 173
171 if (source != this) 174 if (source != this)
172 frame_tree_client_->OnFrameRemoved(removed_node->view_->id()); 175 frame_tree_client_->OnFrameRemoved(removed_node->view_->id());
173 176
174 for (Frame* child : children_) 177 for (Frame* child : children_)
175 child->NotifyRemoved(source, removed_node); 178 child->NotifyRemoved(source, removed_node);
176 } 179 }
177 180
181 void Frame::NotifyFrameNameChanged(const Frame* source) {
182 if (this != source) {
183 frame_tree_client_->OnFrameNameChanged(source->view_->id(), source->name_);
184 }
185
186 for (Frame* child : children_)
187 child->NotifyFrameNameChanged(source);
188 }
189
178 void Frame::OnViewDestroying(mojo::View* view) { 190 void Frame::OnViewDestroying(mojo::View* view) {
179 if (parent_) 191 if (parent_)
180 parent_->Remove(this); 192 parent_->Remove(this);
181 193
182 // Reset |view_ownership_| so we don't attempt to delete |view_| in the 194 // Reset |view_ownership_| so we don't attempt to delete |view_| in the
183 // destructor. 195 // destructor.
184 view_ownership_ = ViewOwnership::DOESNT_OWN_VIEW; 196 view_ownership_ = ViewOwnership::DOESNT_OWN_VIEW;
185 197
186 // Assume the view associated with the root is never deleted out from under 198 // Assume the view associated with the root is never deleted out from under
187 // us. 199 // us.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 loading_ = false; 236 loading_ = false;
225 tree_->LoadingStateChanged(); 237 tree_->LoadingStateChanged();
226 } 238 }
227 239
228 void Frame::ProgressChanged(double progress) { 240 void Frame::ProgressChanged(double progress) {
229 DCHECK(loading_); 241 DCHECK(loading_);
230 progress_ = progress; 242 progress_ = progress;
231 tree_->ProgressChanged(); 243 tree_->ProgressChanged();
232 } 244 }
233 245
246 void Frame::SetFrameName(const mojo::String& name) {
247 if (name_ == name)
248 return;
249
250 name_ = name;
251 tree_->FrameNameChanged(this);
252 }
253
234 } // namespace mandoline 254 } // namespace mandoline
OLDNEW
« no previous file with comments | « mandoline/tab/frame.h ('k') | mandoline/tab/frame_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698